1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Netgen\Bundle\SiteAccessRoutesBundle\Tests\Matcher\Voter; |
4
|
|
|
|
5
|
|
|
use Netgen\Bundle\SiteAccessRoutesBundle\Matcher\Voter\DefaultSiteAccessVoter; |
6
|
|
|
use Netgen\Bundle\SiteAccessRoutesBundle\Matcher\Voter\VoterInterface; |
7
|
|
|
use Netgen\Bundle\SiteAccessRoutesBundle\Tests\TestCase; |
8
|
|
|
|
9
|
|
|
class DefaultSiteAccessVoterTest extends TestCase |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* @var \Netgen\Bundle\SiteAccessRoutesBundle\Matcher\Voter\DefaultSiteAccessVoter |
13
|
|
|
*/ |
14
|
|
|
protected $voter; |
15
|
|
|
|
16
|
|
|
public function setUp() |
17
|
|
|
{ |
18
|
|
|
$this->voter = new DefaultSiteAccessVoter('eng'); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @param string $siteAccess |
23
|
|
|
* @param array $groupConfig |
24
|
|
|
* @param bool $vote |
25
|
|
|
* |
26
|
|
|
* @covers \Netgen\Bundle\SiteAccessRoutesBundle\Matcher\Voter\DefaultSiteAccessVoter::__construct |
27
|
|
|
* @covers \Netgen\Bundle\SiteAccessRoutesBundle\Matcher\Voter\DefaultSiteAccessVoter::vote |
28
|
|
|
* |
29
|
|
|
* @dataProvider voteProvider |
30
|
|
|
*/ |
31
|
|
|
public function testVote($siteAccess, array $groupConfig, $vote) |
32
|
|
|
{ |
33
|
|
|
$this->assertEquals($vote, $this->voter->vote($siteAccess, $groupConfig)); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function voteProvider() |
37
|
|
|
{ |
38
|
|
|
return array( |
39
|
|
|
array('cro', array('_default'), VoterInterface::ABSTAIN), |
40
|
|
|
array('eng', array('_default'), true), |
41
|
|
|
array('extra', array('_default'), VoterInterface::ABSTAIN), |
42
|
|
|
array('cro', array('cro'), VoterInterface::ABSTAIN), |
43
|
|
|
array('eng', array('cro'), VoterInterface::ABSTAIN), |
44
|
|
|
array('extra', array('cro'), VoterInterface::ABSTAIN), |
45
|
|
|
); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|