You are here

protected function BackendCompilerPassTest::getDrivertestMysqlContainer in Drupal 9

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:

Return value

\Symfony\Component\DependencyInjection\ContainerBuilder

1 call to BackendCompilerPassTest::getDrivertestMysqlContainer()
BackendCompilerPassTest::providerTestProcess in core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php
Provides test data for testProcess().

File

core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php, line 158
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')
    ->setMethods(NULL)
    ->disableOriginalConstructor()
    ->getMock();
  $container
    ->set('database', $mock);
  return $container;
}