You are here

public function DatabaseLegacyTest::testDbNextId in Drupal 8

Tests deprecation of the db_next_id() function.

@expectedDeprecation db_next_id() 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 nextId() on it. For example, $injected_database->nextId($existing_id). See https://www.drupal.org/node/2993033

File

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

Class

DatabaseLegacyTest
Deprecation tests cases for the database layer.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testDbNextId() {
  $this
    ->installSchema('system', 'sequences');
  $this
    ->assertEquals(1001, db_next_id(1000));
}