You are here

public function DatabaseLegacyTest::testDbQueryRange in Drupal 8

Tests deprecation of the db_query_range() function.

@expectedDeprecation db_query_range() is deprecated in drupal:8.0.0. It will be removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container and call queryRange() on it. For example, $injected_database->queryRange($query, $from, $count, $args, $options). See https://www.drupal.org/node/2993033

File

core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php, line 481

Class

DatabaseLegacyTest
Deprecation tests cases for the database layer.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testDbQueryRange() {
  $count = count(db_query_range('SELECT name FROM {test}', 1, 3)
    ->fetchAll());
  $this
    ->assertSame(3, $count);
}