ExtractorHandlerCompilerPassSpec   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 0
cbo 4
dl 0
loc 40
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A it_extends_nelmio_extractor_handler_compiler_pass() 0 4 1
A it_implements_compiler_pass_interface() 0 4 1
A it_builds() 0 22 1
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