CheckTagCompilerPassTest::testProcess()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23

Duplication

Lines 23
Ratio 100 %

Importance

Changes 0
Metric Value
dl 23
loc 23
rs 9.552
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Liip\MonitorBundle\Tests\DependencyInjection\Compiler;
4
5
use Liip\MonitorBundle\DependencyInjection\Compiler\CheckTagCompilerPass;
6
use Liip\MonitorBundle\DependencyInjection\Compiler\GroupRunnersCompilerPass;
7
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\Definition;
10
use Symfony\Component\DependencyInjection\Reference;
11
12
/**
13
 * @author Kevin Bond <[email protected]>
14
 */
15 View Code Duplication
class CheckTagCompilerPassTest extends AbstractCompilerPassTestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
    public function testProcess()
18
    {
19
        $defaultGroup = 'gruppo_predefinito';
20
21
        $runner = new Definition();
22
        $this->setDefinition('liip_monitor.runner', $runner);
23
        $this->setParameter('liip_monitor.default_group', $defaultGroup);
24
25
        $check = new Definition();
26
        $check->addTag('liip_monitor.check');
27
        $this->setDefinition('example_check', $check);
28
29
        $this->compile();
30
31
        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
32
            'liip_monitor.runner_'.$defaultGroup,
33
            'addCheck',
34
            [
35
                new Reference('example_check'),
36
                'example_check',
37
            ]
38
        );
39
    }
40
41
    protected function registerCompilerPass(ContainerBuilder $container): void
42
    {
43
        $container->addCompilerPass(new GroupRunnersCompilerPass());
44
        $container->addCompilerPass(new CheckTagCompilerPass());
45
    }
46
}
47