public function DatabaseLegacyTest::testDbIgnoreReplica in Drupal 8
Tests the db_ignore_replica() function.
@expectedDeprecation db_ignore_replica() is deprecated in drupal:8.7.0. It will be removed from drupal:9.0.0. Use \Drupal\Core\Database\ReplicaKillSwitch::trigger() instead. See https://www.drupal.org/node/2997500
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ DatabaseLegacyTest.php, line 529
Class
- DatabaseLegacyTest
- Deprecation tests cases for the database layer.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testDbIgnoreReplica() {
$connection = Database::getConnectionInfo('default');
Database::addConnectionInfo('default', 'replica', $connection['default']);
db_ignore_replica();
/** @var \Symfony\Component\HttpFoundation\Session\SessionInterface $session */
$session = \Drupal::service('session');
$this
->assertTrue($session
->has('ignore_replica_server'));
}