diff -u b/core/lib/Drupal/Core/DependencyInjection/Compiler/BackendCompilerPass.php b/core/lib/Drupal/Core/DependencyInjection/Compiler/BackendCompilerPass.php --- b/core/lib/Drupal/Core/DependencyInjection/Compiler/BackendCompilerPass.php +++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/BackendCompilerPass.php @@ -7,7 +7,6 @@ namespace Drupal\Core\DependencyInjection\Compiler; -use Drupal\Core\Database\ConnectionNotDefinedException; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; diff -u b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php --- b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php @@ -60,32 +60,32 @@ public function providerTestProcess() { $data = array(); // Add a container with no set default_backend. - $prefix = __NAMESPACE__ . '\\'; - $service = (new Definition($prefix . 'ServiceClassDefault'))->addTag('backend_overridable'); - $container = $this->getMysqlContainer($prefix, $service); + $prefix = __NAMESPACE__ . '\\ServiceClass'; + $service = (new Definition($prefix . 'Default'))->addTag('backend_overridable'); + $container = $this->getMysqlContainer($service); - $data[] = array($prefix . 'ServiceClassDefault', $container); + $data[] = array($prefix . 'Default', $container); // Set the default_backend so the mysql service should be used. - $container = $this->getMysqlContainer($prefix, $service); + $container = $this->getMysqlContainer($service); $container->setParameter('default_backend', 'mysql'); - $data[] = array($prefix . 'ServiceClassMysql', $container); + $data[] = array($prefix . 'Mysql', $container); // Configure a manual alias for the service, so ensure that it is not // overridden by the default backend. $container = clone $container; - $container->setDefinition('mariadb.service', new Definition($prefix . 'ServiceClassMariaDb')); + $container->setDefinition('mariadb.service', new Definition($prefix . 'MariaDb')); $container->setAlias('service', new Alias('mariadb.service')); - $data[] = array($prefix . 'ServiceClassMariaDb', $container); + $data[] = array($prefix . 'MariaDb', $container); // Check the database driver is the default. - $container = $this->getSqliteContainer($prefix, $service); - $data[] = array($prefix . 'ServiceClassSqlite', $container); + $container = $this->getSqliteContainer($service); + $data[] = array($prefix . 'Sqlite', $container); // Test the opt out. - $container = $this->getSqliteContainer($prefix, $service); + $container = $this->getSqliteContainer($service); $container->setParameter('default_backend', ''); - $data[] = array($prefix . 'ServiceClassDefault', $container); + $data[] = array($prefix . 'Default', $container); return $data; } @@ -96,14 +96,14 @@ * This is necessary because the container clone does not clone the parameter * bag so the setParameter() call effects the parent container as well. * - * @param $prefix * @param $service * @return ContainerBuilder + * @internal param $prefix */ - protected function getSqliteContainer($prefix, $service) { + protected function getSqliteContainer($service) { $container = new ContainerBuilder(); $container->setDefinition('service', $service); - $container->setDefinition('sqlite.service', new Definition($prefix . 'ServiceClassSqlite')); + $container->setDefinition('sqlite.service', new Definition(__NAMESPACE__ . '\\ServiceClassSqlite')); $container->set('database', new Connection(new \PDO('sqlite::memory:'), [])); return $container; } @@ -114,14 +114,14 @@ * This is necessary because the container clone does not clone the parameter * bag so the setParameter() call effects the parent container as well. * - * @param $prefix * @param $service * @return ContainerBuilder + * @internal param $prefix */ - protected function getMysqlContainer($prefix, $service) { + protected function getMysqlContainer($service) { $container = new ContainerBuilder(); $container->setDefinition('service', $service); - $container->setDefinition('mysql.service', new Definition($prefix . 'ServiceClassMysql')); + $container->setDefinition('mysql.service', new Definition(__NAMESPACE__ . '\\ServiceClassMysql')); return $container; }