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() |
||
50 | |||
51 | /** |
||
52 | * Testing has permission cases |
||
53 | * @throws \Doctrine\ORM\Query\QueryException |
||
54 | * @throws \Potievdev\SlimRbac\Exception\InvalidArgumentException |
||
55 | */ |
||
56 | public function testAccessTrue() |
||
62 | |||
63 | /** |
||
64 | * @return array |
||
65 | */ |
||
66 | public function failCasesProvider() |
||
76 | |||
77 | /** |
||
78 | * Testing not have permission cases |
||
79 | * @param integer $userId user id |
||
80 | * @param string $roleOrPermission role or permission name |
||
81 | * @throws \Doctrine\ORM\Query\QueryException |
||
82 | * @throws \Potievdev\SlimRbac\Exception\InvalidArgumentException |
||
83 | * @dataProvider failCasesProvider |
||
84 | */ |
||
85 | public function testAccessFalse($userId, $roleOrPermission) |
||
89 | |||
90 | /** |
||
91 | * Testing adding not unique permission |
||
92 | * @expectedException \Potievdev\SlimRbac\Exception\NotUniqueException |
||
93 | * @throws \Potievdev\SlimRbac\Exception\DatabaseException |
||
94 | * @throws \Potievdev\SlimRbac\Exception\NotUniqueException |
||
95 | */ |
||
96 | public function testNotUniquePermission() |
||
101 | |||
102 | /** |
||
103 | * Testing adding not unique role |
||
104 | * @expectedException \Potievdev\SlimRbac\Exception\NotUniqueException |
||
105 | * @throws \Potievdev\SlimRbac\Exception\DatabaseException |
||
106 | * @throws \Potievdev\SlimRbac\Exception\NotUniqueException |
||
107 | */ |
||
108 | public function testNonUniqueRole() |
||
113 | |||
114 | /** |
||
115 | * @expectedException \Potievdev\SlimRbac\Exception\CyclicException |
||
116 | * @throws \Potievdev\SlimRbac\Exception\CyclicException |
||
117 | * @throws \Potievdev\SlimRbac\Exception\DatabaseException |
||
118 | * @throws \Potievdev\SlimRbac\Exception\NotUniqueException |
||
119 | * @throws \Doctrine\ORM\Query\QueryException |
||
120 | */ |
||
121 | public function testCyclicException() |
||
132 | |||
133 | /** |
||
134 | * Testing creating permission |
||
135 | */ |
||
136 | public function testCreatingPermission() |
||
145 | |||
146 | /** |
||
147 | * Testing creating role |
||
148 | */ |
||
149 | public function testCreatingRole() |
||
159 | } |
||
160 |