SymfonySecurityBridgeBundleSpec   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 31
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A it_extends_symfony_bundle() 0 4 1
A it_builds_without_dependent_bundles_enabled() 0 4 1
A it_builds() 0 13 1
1
<?php
2
3
/*
4
 * This file is part of the BenGorUser 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\BenGorUser\SymfonySecurityBridgeBundle;
14
15
use BenGorUser\SymfonySecurityBridgeBundle\DependencyInjection\Compiler\SecurityServicesPass;
16
use BenGorUser\SymfonySecurityBridgeBundle\SymfonySecurityBridgeBundle;
17
use PhpSpec\ObjectBehavior;
18
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
19
use Symfony\Component\DependencyInjection\ContainerBuilder;
20
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
21
use Symfony\Component\HttpKernel\Bundle\Bundle;
22
23
/**
24
 * Spec file of SymfonySecurityBridgeBundle class.
25
 *
26
 * @author Beñat Espiña <[email protected]>
27
 */
28
class SymfonySecurityBridgeBundleSpec extends ObjectBehavior
29
{
30
    function it_is_initializable()
31
    {
32
        $this->shouldHaveType(SymfonySecurityBridgeBundle::class);
33
    }
34
35
    function it_extends_symfony_bundle()
36
    {
37
        $this->shouldHaveType(Bundle::class);
38
    }
39
40
    function it_builds_without_dependent_bundles_enabled(ContainerBuilder $container)
41
    {
42
        $this->shouldThrow(RuntimeException::class)->duringBuild($container);
43
    }
44
45
    function it_builds(ContainerBuilder $container)
46
    {
47
        $container->getParameter('kernel.bundles')->shouldBeCalled()->willReturn([
48
            'BenGorUserBundle' => 'BenGorUser\\UserBundle\\BenGorUserBundle',
49
            'SecurityBundle'   => 'Symfony\\Bundle\\SecurityBundle\\SecurityBundle',
50
        ]);
51
52
        $container->addCompilerPass(
53
            new SecurityServicesPass(), PassConfig::TYPE_OPTIMIZE
54
        )->shouldBeCalled()->willReturn($container);
55
56
        $this->build($container);
57
    }
58
}
59