You are here

public function DatabaseLegacyTest::testDbFieldNames in Drupal 8

Tests deprecation of the db_field_names() function.

@expectedDeprecation db_field_names() 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, get its schema driver, and call fieldNames() on it. For example, $injected_database->schema()->fieldNames($fields). See https://www.drupal.org/node/2993033

File

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

Class

DatabaseLegacyTest
Deprecation tests cases for the database layer.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testDbFieldNames() {
  $this
    ->assertSame([
    'test_field',
  ], db_field_names([
    'test_field',
  ]));
}