function ConnectionTest::testGetDriverClass
Same name in this branch
- main core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testGetDriverClass()
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testGetDriverClass()
- 10 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testGetDriverClass()
- 9 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testGetDriverClass()
- 8.9.x core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testGetDriverClass()
- 11.x core/modules/search/tests/src/Unit/Database/ConnectionTest.php \Drupal\Tests\search\Unit\Database\ConnectionTest::testGetDriverClass()
Tests get driver class.
Attributes
#[DataProvider('providerGetDriverClass')]
File
-
core/
modules/ search/ tests/ src/ Unit/ Database/ ConnectionTest.php, line 59
Class
- ConnectionTest
- Tests the connections for the Search queries.
Namespace
Drupal\Tests\search\Unit\DatabaseCode
public function testGetDriverClass(string $expected, ?string $namespace, string $class) : void {
$additional_class_loader = new ClassLoader();
$additional_class_loader->addPsr4("Drupal\\search_fake\\Driver\\Database\\SearchFake\\", __DIR__ . "/../../../modules/search_fake/src/Driver/Database/SearchFake");
$additional_class_loader->addPsr4("Drupal\\search_fake\\Driver\\Database\\SearchFakeWithAllCustomClasses\\", __DIR__ . "/../../../modules/search_fake/src/Driver/Database/SearchFakeWithAllCustomClasses");
$additional_class_loader->register(TRUE);
$connection = new StubConnection($this->createStub(\PDO::class), [
'namespace' => $namespace,
]);
match ($class) { 'Install\\Tasks', 'ExceptionHandler', 'Select', 'Insert', 'Merge', 'Upsert', 'Update', 'Delete', 'Truncate', 'Schema', 'Condition', 'Transaction' => $this->expectExceptionMessageIs('Calling Drupal\\Core\\Database\\Connection::getDriverClass() for \'' . $class . '\' is not supported. Use standard autoloading in the methods that return database operations. See https://www.drupal.org/node/3217534'),
default => NULL,
};
$this->assertEquals($expected, $connection->getDriverClass($class));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.