function ResultTest::testQuery

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/area/ResultTest.php \Drupal\Tests\views\Unit\Plugin\area\ResultTest::testQuery()
  2. 10 core/modules/views/tests/src/Unit/Plugin/area/ResultTest.php \Drupal\Tests\views\Unit\Plugin\area\ResultTest::testQuery()
  3. 11.x 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.