Completed
Push — master ( e835bc...32b1b0 )
by Yaroslav
11:23
created

testSetVariableNames()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 14
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\Security\Authorization;
12
13
use PHPUnit\Framework\TestCase;
14
use Yarhon\RouteGuardBundle\Security\Authorization\SymfonySecurityExpressionVoter;
15
16
/**
17
 * @author Yaroslav Honcharuk <[email protected]>
18
 */
19
class SymfonySecurityExpressionVoterTest extends TestCase
20
{
21
    public function testGetVariableNames()
22
    {
23
        $expected = [
24
            'token',
25
            'user',
26
            'object',
27
            'subject',
28
            'roles',
29
            'trust_resolver',
30
            'request',
31
        ];
32
33
        $this->assertSame($expected, SymfonySecurityExpressionVoter::getVariableNames());
34
    }
35
36
    public function testSetVariableNames()
37
    {
38
        $default = SymfonySecurityExpressionVoter::getVariableNames();
39
40
        $new = [
41
            'foo',
42
            'bar',
43
        ];
44
45
        SymfonySecurityExpressionVoter::setVariableNames($new);
46
47
        $this->assertSame($new, SymfonySecurityExpressionVoter::getVariableNames());
48
49
        SymfonySecurityExpressionVoter::setVariableNames($default);
50
    }
51
}
52