function SelectComplexTest::testRangeUndo

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testRangeUndo()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testRangeUndo()
  3. 11.x core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testRangeUndo()

Tests whether the range property of a select clause can be undone.

File

core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php, line 169

Class

SelectComplexTest
Tests the Select query builder with more complex queries.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testRangeUndo() : void {
  $query = $this->connection
    ->select('test');
  $query->addField('test', 'name');
  $query->addField('test', 'age', 'age');
  $query->range(0, 2);
  $query->range(NULL, NULL);
  $query_result = $query->countQuery()
    ->execute()
    ->fetchField();
  $this->assertEquals(4, $query_result, 'Returned the correct number of rows.');
}

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