Completed
Push — ezp30878_cant_add_image_with_p... ( e19ea7...263f1b )
by
unknown
20:16
created

IdentityDefinerPassTest::testSetIdentityDefiner()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 15
loc 15
rs 9.7666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File containing the IdentityDefinerPassTest class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Bundle\EzPublishCoreBundle\Tests\DependencyInjection\Compiler;
10
11
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\IdentityDefinerPass;
12
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
14
use Symfony\Component\DependencyInjection\Definition;
15
use Symfony\Component\DependencyInjection\Reference;
16
17 View Code Duplication
class IdentityDefinerPassTest 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...
18
{
19
    protected function setUp()
20
    {
21
        parent::setUp();
22
        $this->setDefinition('ezpublish.user.hash_generator', new Definition());
23
    }
24
25
    /**
26
     * Register the compiler pass under test, just like you would do inside a bundle's load()
27
     * method:.
28
     *
29
     *   $container->addCompilerPass(new MyCompilerPass());
30
     */
31
    protected function registerCompilerPass(ContainerBuilder $container)
32
    {
33
        $container->addCompilerPass(new IdentityDefinerPass());
34
    }
35
36
    /**
37
     * @covers \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\IdentityDefinerPass::process
38
     */
39
    public function testSetIdentityDefiner()
40
    {
41
        $def = new Definition();
42
        $def->addTag('ezpublish.identity_definer');
43
        $serviceId = 'some_service_id';
44
        $this->setDefinition($serviceId, $def);
45
46
        $this->compile();
47
48
        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
49
            'ezpublish.user.hash_generator',
50
            'setIdentityDefiner',
51
            [new Reference($serviceId)]
52
        );
53
    }
54
}
55