testProcessWithoutExtraBundle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 *
5
 * (c) Yaroslav Honcharuk <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Yarhon\RouteGuardBundle\Tests\DependencyInjection\Compiler;
12
13
use PHPUnit\Framework\TestCase;
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Yarhon\RouteGuardBundle\DependencyInjection\Compiler\SensioSecurityExpressionVoterPass;
16
use Yarhon\RouteGuardBundle\Security\Authorization\SensioSecurityExpressionVoter;
17
18
/**
19
 * @author Yaroslav Honcharuk <[email protected]>
20
 */
21
class SensioSecurityExpressionVoterPassTest extends TestCase
22
{
23
    /**
24
     * @var ContainerBuilder
25
     */
26
    private $container;
27
28
    /**
29
     * @var SensioSecurityExpressionVoterPass
30
     */
31
    private $pass;
32
33
    public function setUp()
34
    {
35
        $this->container = new ContainerBuilder();
36
        $this->container->register(SensioSecurityExpressionVoter::class);
37
        $this->pass = new SensioSecurityExpressionVoterPass();
38
    }
39
40
    public function testProcessWithoutExtraBundle()
41
    {
42
        $this->pass->process($this->container);
43
44
        $this->assertFalse($this->container->hasDefinition(SensioSecurityExpressionVoter::class));
45
    }
46
47
    public function testProcessWithExtraBundle()
48
    {
49
        $this->container->register('sensio_framework_extra.security.listener');
50
        $this->container->register('sensio_framework_extra.security.expression_language.default');
51
52
        $this->pass->process($this->container);
53
54
        $this->assertTrue($this->container->hasDefinition(SensioSecurityExpressionVoter::class));
55
    }
56
}
57