function ConnectionTest::testLegacyDatabaseDriverInRootDriversDirectory
Tests the deprecation of Drupal 8 style database drivers.
@group legacy
File
- 
              core/tests/ Drupal/ Tests/ Core/ Database/ ConnectionTest.php, line 725 
Class
- ConnectionTest
- Tests the Connection class.
Namespace
Drupal\Tests\Core\DatabaseCode
public function testLegacyDatabaseDriverInRootDriversDirectory() {
  $this->expectDeprecation('Support for database drivers located in the "drivers/lib/Drupal/Driver/Database" directory is deprecated in drupal:9.1.0 and is removed in drupal:10.0.0. Contributed and custom database drivers should be provided by modules and use the namespace "Drupal\\MODULE_NAME\\Driver\\Database\\DRIVER_NAME". See https://www.drupal.org/node/3123251');
  $namespace = 'Drupal\\Driver\\Database\\Stub';
  $mock_pdo = $this->createMock(StubPDO::class);
  $connection = new StubConnection($mock_pdo, [
    'namespace' => $namespace,
  ], [
    '"',
    '"',
  ]);
  $this->assertEquals($namespace, $connection->getConnectionOptions()['namespace']);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
