function BackendCompilerPassTest::getMysqlContainer

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. 8.9.x core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\BackendCompilerPassTest::getMysqlContainer()
  3. 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: The service definition.

Return value

\Symfony\Component\DependencyInjection\ContainerBuilder

1 call to BackendCompilerPassTest::getMysqlContainer()
BackendCompilerPassTest::testProcess in core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php
Tests the process method.

File

core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php, line 128

Class

BackendCompilerPassTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21DependencyInjection%21Compiler%21BackendCompilerPass.php/class/BackendCompilerPass/11.x" title="Defines a compiler pass to allow automatic override per backend." class="local">\Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass</a> @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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.