protected function BackendCompilerPassTest::getSqliteContainer in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\BackendCompilerPassTest::getSqliteContainer()
- 9 core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\BackendCompilerPassTest::getSqliteContainer()
Creates a container with a sqlite database service in it.
This is necessary because the container clone does not clone the parameter bag so the setParameter() call effects the parent container as well.
Parameters
$service: The service definition.
Return value
\Symfony\Component\DependencyInjection\ContainerBuilder
File
- core/
tests/ Drupal/ Tests/ Core/ DependencyInjection/ Compiler/ BackendCompilerPassTest.php, line 123 - Contains \Drupal\Tests\Core\DependencyInjection\Compiler\BackendCompilerPassTest.
Class
- BackendCompilerPassTest
- @coversDefaultClass \Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass @group DependencyInjection
Namespace
Drupal\Tests\Core\DependencyInjection\CompilerCode
protected function getSqliteContainer($service) {
$container = new ContainerBuilder();
$container
->setDefinition('service', $service);
$container
->setDefinition('sqlite.service', new Definition(__NAMESPACE__ . '\\ServiceClassSqlite'));
$mock = $this
->getMockBuilder('Drupal\\sqlite\\Driver\\Database\\sqlite\\Connection')
->onlyMethods([])
->disableOriginalConstructor()
->getMock();
$container
->set('database', $mock);
return $container;
}