function DatabaseLegacyTest::testDbGetTarget

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

File

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

Class

DatabaseLegacyTest
Deprecation tests cases for the database layer.

Namespace

Drupal\KernelTests\Core\Database

Code

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.