function SelectComplexTest::testRange
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testRange()
- 10 core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testRange()
- 11.x core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testRange()
Tests range queries.
The SQL clause varies with the database.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ SelectComplexTest.php, line 157
Class
- SelectComplexTest
- Tests the Select query builder with more complex queries.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testRange() {
$query = $this->connection
->select('test');
$query->addField('test', 'name');
$query->addField('test', 'age', 'age');
$query->range(0, 2);
$query_result = $query->countQuery()
->execute()
->fetchField();
$this->assertEquals(2, $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.