SensioSecurityExpressionVoterPassTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
dl 0
loc 34
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testProcessWithExtraBundle() 0 8 1
A setUp() 0 5 1
A testProcessWithoutExtraBundle() 0 5 1
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