RemoveUnavailableServicesPassSpec   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 43
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A it_should_remove_services_when_dependant_service_does_not_exist() 0 15 1
A it_should_remove_services_when_one_of_dependant_service_does_not_exist() 0 19 1
1
<?php
2
3
namespace spec\Knp\RadBundle\DependencyInjection\Compiler;
4
5
use PhpSpec\ObjectBehavior;
6
use Prophecy\Argument;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
9
class RemoveUnavailableServicesPassSpec extends ObjectBehavior
10
{
11
    function it_is_initializable()
0 ignored issues
show
Coding Style introduced by
Method name "RemoveUnavailableServicesPassSpec::it_is_initializable" is not in camel caps format
Loading history...
12
    {
13
        $this->shouldHaveType('Knp\RadBundle\DependencyInjection\Compiler\RemoveUnavailableServicesPass');
14
    }
15
16
    function it_should_remove_services_when_dependant_service_does_not_exist(ContainerBuilder $container)
0 ignored issues
show
Coding Style introduced by
Method name "RemoveUnavailableServicesPassSpec::it_should_remove_services_when_dependant_service_does_not_exist" is not in camel caps format
Loading history...
17
    {
18
        $container->findTaggedServiceIds('remove-when-missing')->willReturn(array(
19
            'knp_rad.form.manager' => array(
20
                array('service' => 'form.factory'),
21
            ),
22
        ));
23
24
        $container->hasDefinition('form.factory')->willReturn(false);
25
        $container->hasAlias('form.factory')->willReturn(false);
26
27
        $container->removeDefinition('knp_rad.form.manager')->shouldBeCalled();
28
29
        $this->process($container);
30
    }
31
32
    function it_should_remove_services_when_one_of_dependant_service_does_not_exist(ContainerBuilder $container)
0 ignored issues
show
Coding Style introduced by
Method name "RemoveUnavailableServicesPassSpec::it_should_remove_services_when_one_of_dependant_service_does_not_exist" is not in camel caps format
Loading history...
33
    {
34
        $container->findTaggedServiceIds('remove-when-missing')->willReturn(array(
35
            'knp_rad.form.type_creator' => array(
36
                array('service' => 'form.factory'),
37
                array('service' => 'form.registry'),
38
            ),
39
        ));
40
41
        $container->hasDefinition('form.factory')->willReturn(true);
42
        $container->hasAlias('form.factory')->willReturn(true);
43
44
        $container->hasDefinition('form.registry')->willReturn(false);
45
        $container->hasAlias('form.registry')->willReturn(false);
46
47
        $container->removeDefinition('knp_rad.form.type_creator')->shouldBeCalled();
48
49
        $this->process($container);
50
    }
51
}
52