Completed
Push — ezp-30882-thumbnail ( 274ed9...d4335b )
by
unknown
14:43
created

ViewMatcherRegistryPassTest::testSetMatcher()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 18
loc 18
rs 9.6666
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 View Code Duplication
class ViewMatcherRegistryPassTest 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...
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