function QueryTest::queryMethodsTests

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Plugin/QueryTest.php \Drupal\Tests\views\Kernel\Plugin\QueryTest::queryMethodsTests()
  2. 8.9.x core/modules/views/tests/src/Kernel/Plugin/QueryTest.php \Drupal\Tests\views\Kernel\Plugin\QueryTest::queryMethodsTests()
  3. 11.x core/modules/views/tests/src/Kernel/Plugin/QueryTest.php \Drupal\Tests\views\Kernel\Plugin\QueryTest::queryMethodsTests()

Tests methods provided by the QueryPluginBase.

See also

\Drupal\views\Plugin\views\query\QueryPluginBase

1 call to QueryTest::queryMethodsTests()
QueryTest::testQuery in core/modules/views/tests/src/Kernel/Plugin/QueryTest.php
Tests query plugins.

File

core/modules/views/tests/src/Kernel/Plugin/QueryTest.php, line 68

Class

QueryTest
Tests query plugins.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

protected function queryMethodsTests() {
    $view = Views::getView('test_view');
    $view->setDisplay();
    $view->initQuery();
    $this->assertNull($view->query
        ->getLimit(), 'Default to an empty limit.');
    $rand_number = rand(5, 10);
    $view->query
        ->setLimit($rand_number);
    $this->assertEquals($rand_number, $view->query
        ->getLimit(), 'set_limit adapts the amount of items.');
}

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