function DatabaseDriverListTest::testLegacyGet

@covers ::get @group legacy

@dataProvider providerDatabaseDrivers

File

core/tests/Drupal/Tests/Core/Extension/DatabaseDriverListTest.php, line 36

Class

DatabaseDriverListTest
Tests DatabaseDriverList methods.

Namespace

Drupal\Tests\Core\Extension

Code

public function testLegacyGet(string $driverName, string $moduleName, string $driverExtensionName) : void {
    $this->expectDeprecation("Passing a database driver name '{$driverName}' to Drupal\\Core\\Extension\\DatabaseDriverList::get() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Pass a database driver namespace instead. See https://www.drupal.org/node/3258175");
    $this->expectDeprecation('Drupal\\Core\\Extension\\DatabaseDriverList::getFromDriverName() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use DatabaseDriverList::get() instead, passing a database driver namespace. See https://www.drupal.org/node/3258175');
    $driverExtension = Database::getDriverList()->includeTestDrivers(TRUE)
        ->get($driverName);
    $this->assertSame($driverExtensionName, $driverExtension->getName());
    $this->assertSame($moduleName, $driverExtension->getModule()
        ->getName());
    $this->assertSame($driverName, $driverExtension->getDriverName());
}

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