You are here

protected function BackendCompilerPassTest::getDrivertestMysqlContainer in Drupal 10

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\BackendCompilerPassTest::getDrivertestMysqlContainer()

Creates a container with a DrivertestMysql database mock definition 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 161
Contains \Drupal\Tests\Core\DependencyInjection\Compiler\BackendCompilerPassTest.

Class

BackendCompilerPassTest
@coversDefaultClass \Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass @group DependencyInjection

Namespace

Drupal\Tests\Core\DependencyInjection\Compiler

Code

protected function getDrivertestMysqlContainer($service) {
  $container = new ContainerBuilder();
  $container
    ->setDefinition('service', $service);
  $mock = $this
    ->getMockBuilder('Drupal\\driver_test\\Driver\\Database\\DrivertestMysql\\Connection')
    ->onlyMethods([])
    ->disableOriginalConstructor()
    ->getMock();
  $container
    ->set('database', $mock);
  return $container;
}