You are here

public function DatabaseLegacyTest::testDbSetActive in Drupal 8

Tests the db_set_active() function.

@expectedDeprecation db_set_active() is deprecated in drupal:8.0.0. It will be removed from drupal:9.0.0. Use \Drupal\Core\Database\Database::setActiveConnection() instead. See https://www.drupal.org/node/2993033

File

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

Class

DatabaseLegacyTest
Deprecation tests cases for the database layer.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testDbSetActive() {
  $get_active_db = $this->connection
    ->getKey();
  $this
    ->assert(db_set_active($get_active_db), 'Database connection is active');
}