public function SelectComplexTest::testRange in Drupal 9
Same name and namespace in other branches
- 8 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 153
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.');
}