You are here

protected function QueryTest::queryMethodsTests in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/Plugin/QueryTest.php \Drupal\Tests\views\Kernel\Plugin\QueryTest::queryMethodsTests()
  2. 9 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 66

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.');
}