Unverified Commit 3c5675d1 authored by alexpott's avatar alexpott
Browse files

Issue #3049380 by voleger: Complete deprecation of _db_get_target() function

parent da11531a
......@@ -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 @@ public function testDbIgnoreReplica() {
$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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment