ExtractorHandlerCompilerPassSpec::it_builds()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 22
rs 9.2
cc 1
eloc 16
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace spec\Kreta\SimpleApiDocBundle\DependencyInjection\Compiler;
14
15
use PhpSpec\ObjectBehavior;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Definition;
18
use Symfony\Component\DependencyInjection\Reference;
19
20
/**
21
 * Spec of Extractor Handler Compiler Pass class.
22
 *
23
 * @author Beñat Espiña <[email protected]>
24
 */
25
class ExtractorHandlerCompilerPassSpec extends ObjectBehavior
26
{
27
    function it_is_initializable()
28
    {
29
        $this->shouldHaveType('Kreta\SimpleApiDocBundle\DependencyInjection\Compiler\ExtractorHandlerCompilerPass');
30
    }
31
32
    function it_extends_nelmio_extractor_handler_compiler_pass()
33
    {
34
        $this->shouldHaveType('Nelmio\ApiDocBundle\DependencyInjection\ExtractorHandlerCompilerPass');
35
    }
36
37
    function it_implements_compiler_pass_interface()
38
    {
39
        $this->shouldImplement('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface');
40
    }
41
42
    function it_builds(ContainerBuilder $container, Definition $definition)
43
    {
44
        $container->findTaggedServiceIds('nelmio_api_doc.extractor.handler')
45
            ->shouldBeCalled()->willReturn(['id' => ['attr1', 'attr2']]);
46
47
        $container->findTaggedServiceIds('nelmio_api_doc.extractor.annotations_provider')
48
            ->shouldBeCalled()->willReturn(['id' => ['attr1', 'attr2']]);
49
50
        $container->getDefinition('kreta_simple_api_doc.extractor.api_doc_extractor')
51
            ->shouldBeCalled()->willReturn($definition);
52
        $definition->replaceArgument(
53
            5, [new Reference('id')]
54
        )->shouldBeCalled()->willReturn($definition);
55
56
        $container->getDefinition('kreta_simple_api_doc.extractor.api_doc_extractor')
57
            ->shouldBeCalled()->willReturn($definition);
58
        $definition->replaceArgument(
59
            6, [new Reference('id')]
60
        )->shouldBeCalled()->willReturn($definition);
61
62
        $this->process($container);
63
    }
64
}
65