Issue #3049380 by voleger: Complete deprecation of _db_get_target() function
parent
da11531a16
commit
3c5675d1b2
|
@ -464,6 +464,7 @@ function db_close(array $options = []) {
|
|||
* @see https://www.drupal.org/node/2993033
|
||||
*/
|
||||
function _db_get_target(array &$options, $allow_replica = TRUE) {
|
||||
@trigger_error('_db_get_target() is deprecated in drupal:8.8.0. Will be removed before drupal:9.0.0. See https://www.drupal.org/node/2993033', E_USER_DEPRECATED);
|
||||
if (empty($options['target']) || ($options['target'] === 'replica' && !$allow_replica)) {
|
||||
$options['target'] = 'default';
|
||||
}
|
||||
|
|
|
@ -530,4 +530,17 @@ class DatabaseLegacyTest extends DatabaseTestBase {
|
|||
$this->assertTrue($session->has('ignore_replica_server'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the _db_get_target() function.
|
||||
*
|
||||
* @expectedDeprecation _db_get_target() is deprecated in drupal:8.8.0. Will be removed before drupal:9.0.0. See https://www.drupal.org/node/2993033
|
||||
*/
|
||||
public function testDbGetTarget() {
|
||||
$op1 = $op2 = ['target' => 'replica'];
|
||||
$this->assertEquals('replica', _db_get_target($op1));
|
||||
$this->assertEquals('default', _db_get_target($op2, FALSE));
|
||||
$this->assertEmpty($op1);
|
||||
$this->assertEmpty($op2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue