SecurityVoterFactorySpec::let()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 4
1
<?php
2
3
namespace spec\Knp\RadBundle\DependencyInjection\Definition;
4
5
use PhpSpec\ObjectBehavior;
6
7
class SecurityVoterFactorySpec extends ObjectBehavior
8
{
9
    /**
10
     * @param  Knp\RadBundle\Reflection\ReflectionFactory $reflectionFactory
11
     * @param  Knp\RadBundle\DependencyInjection\ReferenceFactory $referenceFactory
12
     * @param  ReflectionClass $reflClass
13
     * @param  Symfony\Component\DependencyInjection\Reference $containerRef
14
     */
15
    function let($reflectionFactory, $referenceFactory, $reflClass, $containerRef)
16
    {
17
        $this->beConstructedWith($reflectionFactory, $referenceFactory);
18
19
        $reflectionFactory->createReflectionClass('App\Security\CheeseVoter')->willReturn($reflClass);
20
        $referenceFactory->createReference('service_container')->willReturn($containerRef);
21
    }
22
23
    function it_should_create_a_service_definition_for_the_specified_security_voter_class($reflClass)
0 ignored issues
show
Coding Style introduced by
Method name "SecurityVoterFactorySpec::it_should_create_a_service_definition_for_the_specified_security_voter_class" is not in camel caps format
Loading history...
24
    {
25
        $reflClass->implementsInterface('Symfony\Component\DependencyInjection\ContainerAwareInterface')->willReturn(false);
26
27
        $definition = $this->createDefinition('App\Security\CheeseVoter');
28
        $definition->shouldBeAnInstanceOf('Symfony\Component\DependencyInjection\Definition');
29
        $definition->getClass()->shouldReturn('App\Security\CheeseVoter');
30
        $definition->getMethodCalls()->shouldReturn(array());
31
    }
32
33
    function it_should_add_method_call_to_inject_container_to_container_aware_voters($reflClass, $containerRef)
0 ignored issues
show
Coding Style introduced by
Method name "SecurityVoterFactorySpec::it_should_add_method_call_to_inject_container_to_container_aware_voters" is not in camel caps format
Loading history...
34
    {
35
        $reflClass->implementsInterface('Symfony\Component\DependencyInjection\ContainerAwareInterface')->willReturn(true);
36
37
        $definition = $this->createDefinition('App\Security\CheeseVoter');
38
        $definition->shouldBeAnInstanceOf('Symfony\Component\DependencyInjection\Definition');
39
        $definition->getClass()->shouldReturn('App\Security\CheeseVoter');
40
        $definition->getMethodCalls()->shouldReturn(array(array('setContainer', array($containerRef->getWrappedObject()))));
41
    }
42
}
43