You are here

protected function QueryTest::queryMethodsTests in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/Plugin/QueryTest.php \Drupal\Tests\views\Kernel\Plugin\QueryTest::queryMethodsTests()

Test 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
    ->assertEqual($view->query
    ->getLimit(), $rand_number, 'set_limit adapts the amount of items.');
}