function BackendCompilerPassTest::getDriverTestMysqlContainer

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\BackendCompilerPassTest::getDrivertestMysqlContainer()
  2. 10 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

\Symfony\Component\DependencyInjection\Definition $service: The service definition.

Return value

\Symfony\Component\DependencyInjection\ContainerBuilder

1 call to BackendCompilerPassTest::getDriverTestMysqlContainer()
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 146

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;
}

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