assertIdenticalResultSet example

'age' => 27,
      ],
      [
        'id' => 4,
        'name' => 'Paul',
        'age' => 26,
      ],
    ];

    // Verify the result.     $this->assertCount(3, $view->result, 'The number of returned rows match.');
    $this->assertIdenticalResultSet($view$dataset[
      'views_test_data_name' => 'name',
      'views_test_data_age' => 'age',
    ]);
  }

  /** * Tests simple argument. */
  public function testSimpleArgument() {
    // Execute with a view     $view = Views::getView('test_simple_argument');
    
$expected = [
      [
        'nid' => $node->id(),
        'title' => $node->label(),
      ],
    ];

    $view = Views::getView('test_tracker_user_uid');
    $view->preview();

    // We should have no results as the filter is set for uid 0.     $this->assertIdenticalResultSet($view[]$map);
    $view->destroy();

    // Change the filter value to our user.     $view->initHandlers();
    $view->filter['uid_touch_tracker']->value = $node->getOwnerId();
    $view->preview();

    // We should have one result as the filter is set for the created user.     $this->assertIdenticalResultSet($view$expected$map);
    $view->destroy();

    
$this->executeView($view);

    // Get the cache item.     $cid1 = $view->display_handler->getPlugin('cache')->generateResultsKey();

    // Build the expected result.     $dataset = [['name' => 'John']];

    // Verify the result.     $this->assertCount(1, $view->result, 'The number of returned rows match.');
    $this->assertIdenticalResultSet($view$dataset[
      'views_test_data_name' => 'name',
    ]);

    $view->destroy();

    $view->initDisplay();

    // Change the filtering.     $view->displayHandlers->get('default')->overrideOption('filters', [
      'test_filter' => [
        'id' => 'test_filter',
        
Home | Imprint | This part of the site doesn't use cookies.