
| Current Path : /var/www/html/strat/web/core/tests/Drupal/KernelTests/Core/Database/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/strat/web/core/tests/Drupal/KernelTests/Core/Database/RangeQueryTest.php |
<?php
declare(strict_types=1);
namespace Drupal\KernelTests\Core\Database;
/**
* Tests the Range query functionality.
*
* @group Database
*/
class RangeQueryTest extends DatabaseTestBase {
/**
* Confirms that range queries work and return the correct result.
*/
public function testRangeQuery(): void {
// Test if return correct number of rows.
$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.');
// Test if return target data.
$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);
}
}