RangeQueryTest.php in Drupal 9
File
core/tests/Drupal/KernelTests/Core/Database/RangeQueryTest.php
View source
<?php
namespace Drupal\KernelTests\Core\Database;
class RangeQueryTest extends DatabaseTestBase {
public function testRangeQuery() {
$range_rows = $this->connection
->queryRange("SELECT [name] FROM {test} ORDER BY [name]", 1, 3)
->fetchAll();
$this
->assertCount(3, $range_rows, 'Range query work and return correct number of rows.');
$raw_rows = $this->connection
->query('SELECT [name] FROM {test} ORDER BY [name]')
->fetchAll();
$raw_rows = array_slice($raw_rows, 1, 3);
$this
->assertEquals($range_rows, $raw_rows);
}
}