You are here

protected function BackendCompilerPassTest::getMysqlContainer in Drupal 8

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

Creates a container with a mysql database service 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::getMysqlContainer()
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 122
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 getMysqlContainer($service) {
  $container = new ContainerBuilder();
  $container
    ->setDefinition('service', $service);
  $container
    ->setDefinition('mysql.service', new Definition(__NAMESPACE__ . '\\ServiceClassMysql'));
  return $container;
}