public function BackendCompilerPassTest::providerTestProcess in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\BackendCompilerPassTest::providerTestProcess()
Provides test data for testProcess().
Return value
array
File
- core/
tests/ Drupal/ Tests/ Core/ DependencyInjection/ Compiler/ BackendCompilerPassTest.php, line 59 - Contains \Drupal\Tests\Core\DependencyInjection\Compiler\BackendCompilerPassTest.
Class
- BackendCompilerPassTest
- @coversDefaultClass \Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass @group DependencyInjection
Namespace
Drupal\Tests\Core\DependencyInjection\CompilerCode
public function providerTestProcess() {
$data = [];
// Add a container with no set default_backend.
$prefix = __NAMESPACE__ . '\\ServiceClass';
$service = (new Definition($prefix . 'Default'))
->addTag('backend_overridable');
$container = $this
->getMysqlContainer($service);
$data[] = [
$prefix . 'Default',
$container,
];
// Set the default_backend so the mysql service should be used.
$container = $this
->getMysqlContainer($service);
$container
->setParameter('default_backend', 'mysql');
$data[] = [
$prefix . 'Mysql',
$container,
];
// Configure a manual alias for the service, so ensure that it is not
// overridden by the default backend.
$container = $this
->getMysqlContainer($service);
$container
->setParameter('default_backend', 'mysql');
$container
->setDefinition('mariadb.service', new Definition($prefix . 'MariaDb'));
$container
->setAlias('service', new Alias('mariadb.service'));
$data[] = [
$prefix . 'MariaDb',
$container,
];
// Check the database driver is the default.
$container = $this
->getSqliteContainer($service);
$data[] = [
$prefix . 'Sqlite',
$container,
];
// Test the opt out.
$container = $this
->getSqliteContainer($service);
$container
->setParameter('default_backend', '');
$data[] = [
$prefix . 'Default',
$container,
];
// Set the mysql and the DrivertestMysql service, now the DrivertestMysql
// service, as it is the driver override, should be used.
$container = $this
->getDrivertestMysqlContainer($service);
$container
->setDefinition('mysql.service', new Definition(__NAMESPACE__ . '\\ServiceClassMysql'));
$container
->setDefinition('DrivertestMysql.service', new Definition(__NAMESPACE__ . '\\ServiceClassDrivertestMysql'));
$data[] = [
$prefix . 'DrivertestMysql',
$container,
];
// Set the mysql service, now the mysql service, as it is the database_type
// override, should be used.
$container = $this
->getDrivertestMysqlContainer($service);
$container
->setDefinition('mysql.service', new Definition(__NAMESPACE__ . '\\ServiceClassMysql'));
$data[] = [
$prefix . 'Mysql',
$container,
];
// Set the DrivertestMysql service, now the DrivertestMysql service, as it
// is the driver override, should be used.
$container = $this
->getDrivertestMysqlContainer($service);
$container
->setDefinition('DrivertestMysql.service', new Definition(__NAMESPACE__ . '\\ServiceClassDrivertestMysql'));
$data[] = [
$prefix . 'DrivertestMysql',
$container,
];
return $data;
}