Completed
Push — master ( ca8025...177d87 )
by Łukasz
14:26
created

ViewMatcherRegistryPassTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Bundle\EzPublishCoreBundle\Tests\DependencyInjection\Compiler;
10
11
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ViewMatcherRegistryPass;
12
use eZ\Bundle\EzPublishCoreBundle\Matcher\ViewMatcherRegistry;
13
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\DependencyInjection\Definition;
16
use Symfony\Component\DependencyInjection\Reference;
17
18
class ViewMatcherRegistryPassTest extends AbstractCompilerPassTestCase
19
{
20
    protected function setUp(): void
21
    {
22
        parent::setUp();
23
24
        $this->setDefinition(ViewMatcherRegistry::class, new Definition());
25
    }
26
27
    protected function registerCompilerPass(ContainerBuilder $container): void
28
    {
29
        $container->addCompilerPass(new ViewMatcherRegistryPass());
30
    }
31
32
    public function testSetMatcher(): void
33
    {
34
        $def = new Definition();
35
        $def->addTag(ViewMatcherRegistryPass::MATCHER_TAG);
36
        $serviceId = 'service_id';
37
        $this->setDefinition($serviceId, $def);
38
39
        $this->compile();
40
41
        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
42
            ViewMatcherRegistry::class,
43
            'setMatcher',
44
            [
45
                $serviceId,
46
                new Reference($serviceId),
47
            ]
48
        );
49
    }
50
}
51