Completed
Push — master ( 051826...bdcfe3 )
by Alessandro
06:32
created

TestContainer::getContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
rs 9.4285
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
namespace Paraunit\Tests;
4
5
use Paraunit\Lifecycle\CompilerPass;
6
use Symfony\Component\Config\FileLocator;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
9
10
/**
11
 * Class TestContainer
12
 * @package Paraunit\Tests
13
 */
14
class TestContainer
15
{
16
    /**
17
     * @return ContainerBuilder
18
     */
19
    public static function getContainer()
20
    {
21
        $container = new ContainerBuilder();
22
23
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/'));
24
        $loader->load('services.yml');
25
26
        $container->addCompilerPass(
27
            new CompilerPass(
28
                'event_dispatcher',
29
                'paraunit.event_listener',
30
                'paraunit.event_subscriber'
31
            )
32
        );
33
34
        $container->compile();
35
36
        return $container;
37
    }
38
}
39