You are here

public function ResultTest::testQuery in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Unit/Plugin/area/ResultTest.php \Drupal\Tests\views\Unit\Plugin\area\ResultTest::testQuery()
  2. 9 core/modules/views/tests/src/Unit/Plugin/area/ResultTest.php \Drupal\Tests\views\Unit\Plugin\area\ResultTest::testQuery()

Tests the query method.

File

core/modules/views/tests/src/Unit/Plugin/area/ResultTest.php, line 54

Class

ResultTest
@coversDefaultClass \Drupal\views\Plugin\views\area\Result @group views

Namespace

Drupal\Tests\views\Unit\Plugin\area

Code

public function testQuery() {
  $this
    ->assertNull($this->view->get_total_rows);

  // @total should set get_total_rows.
  $this->resultHandler->options['content'] = '@total';
  $this->resultHandler
    ->query();
  $this
    ->assertTrue($this->view->get_total_rows);

  // A different token should not.
  $this->view->get_total_rows = NULL;
  $this->resultHandler->options['content'] = '@current_page';
  $this->resultHandler
    ->query();
  $this
    ->assertNull($this->view->get_total_rows);
}