1 | <?php |
||
13 | class AuthManagerTest extends BaseTestCase |
||
14 | { |
||
15 | |||
16 | /** @var AuthManager $authManager */ |
||
17 | protected $authManager; |
||
18 | |||
19 | /** |
||
20 | * @throws \Potievdev\SlimRbac\Exception\CyclicException |
||
21 | * @throws \Potievdev\SlimRbac\Exception\DatabaseException |
||
22 | * @throws \Potievdev\SlimRbac\Exception\NotUniqueException |
||
23 | * @throws \Doctrine\ORM\Query\QueryException |
||
24 | */ |
||
25 | public function setUp() |
||
51 | |||
52 | /** |
||
53 | * Testing has permission cases |
||
54 | * @throws \Doctrine\ORM\Query\QueryException |
||
55 | * @throws \Potievdev\SlimRbac\Exception\InvalidArgumentException |
||
56 | */ |
||
57 | public function testAccessTrue() |
||
63 | |||
64 | /** |
||
65 | * @return array |
||
66 | */ |
||
67 | public function failCasesProvider() |
||
77 | |||
78 | /** |
||
79 | * Testing not have permission cases |
||
80 | * @param integer $userId user id |
||
81 | * @param string $roleOrPermission role or permission name |
||
82 | * @throws \Doctrine\ORM\Query\QueryException |
||
83 | * @throws \Potievdev\SlimRbac\Exception\InvalidArgumentException |
||
84 | * @dataProvider failCasesProvider |
||
85 | */ |
||
86 | public function testAccessFalse($userId, $roleOrPermission) |
||
90 | |||
91 | /** |
||
92 | * Testing adding not unique permission |
||
93 | * @expectedException \Potievdev\SlimRbac\Exception\NotUniqueException |
||
94 | * @throws \Potievdev\SlimRbac\Exception\DatabaseException |
||
95 | * @throws \Potievdev\SlimRbac\Exception\NotUniqueException |
||
96 | */ |
||
97 | public function testNotUniquePermission() |
||
102 | |||
103 | /** |
||
104 | * Testing adding not unique role |
||
105 | * @expectedException \Potievdev\SlimRbac\Exception\NotUniqueException |
||
106 | * @throws \Potievdev\SlimRbac\Exception\DatabaseException |
||
107 | * @throws \Potievdev\SlimRbac\Exception\NotUniqueException |
||
108 | */ |
||
109 | public function testNonUniqueRole() |
||
114 | |||
115 | /** |
||
116 | * @expectedException \Potievdev\SlimRbac\Exception\CyclicException |
||
117 | * @throws \Potievdev\SlimRbac\Exception\CyclicException |
||
118 | * @throws \Potievdev\SlimRbac\Exception\DatabaseException |
||
119 | * @throws \Potievdev\SlimRbac\Exception\NotUniqueException |
||
120 | * @throws \Doctrine\ORM\Query\QueryException |
||
121 | */ |
||
122 | public function testCyclicException() |
||
133 | |||
134 | /** |
||
135 | * Testing creating permission |
||
136 | */ |
||
137 | public function testCreatingPermission() |
||
146 | |||
147 | /** |
||
148 | * Testing creating role |
||
149 | */ |
||
150 | public function testCreatingRole() |
||
160 | } |
||
161 |