You are here

public function BasicTest::testSimpleResultSet in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/BasicTest.php \Drupal\Tests\views\Kernel\BasicTest::testSimpleResultSet()

Tests a trivial result set.

File

core/modules/views/tests/src/Kernel/BasicTest.php, line 24

Class

BasicTest
A basic query test for Views.

Namespace

Drupal\Tests\views\Kernel

Code

public function testSimpleResultSet() {
  $view = Views::getView('test_view');
  $view
    ->setDisplay();

  // Execute the view.
  $this
    ->executeView($view);

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