@@ 177-192 (lines=16) @@ | ||
174 | * @throws \Potievdev\SlimRbac\Exception\NotUniqueException |
|
175 | * @expectedException \Potievdev\SlimRbac\Exception\NotUniqueException |
|
176 | */ |
|
177 | public function testCheckDoubleAssigningPermissionToSameRole() |
|
178 | { |
|
179 | $repositoryRegistry = $this->createRepositoryRegistry(); |
|
180 | ||
181 | /** @var Role $role */ |
|
182 | $role = $repositoryRegistry |
|
183 | ->getRoleRepository() |
|
184 | ->findOneBy(['name' => 'admin']); |
|
185 | ||
186 | /** @var Permission $permission */ |
|
187 | $permission = $repositoryRegistry |
|
188 | ->getPermissionRepository() |
|
189 | ->findOneBy(['name' => 'write']); |
|
190 | ||
191 | $this->authManager->addChildPermission($role, $permission); |
|
192 | } |
|
193 | ||
194 | /** |
|
195 | * @throws \Doctrine\ORM\Query\QueryException |
|
@@ 201-216 (lines=16) @@ | ||
198 | * @throws \Potievdev\SlimRbac\Exception\NotUniqueException |
|
199 | * @expectedException \Potievdev\SlimRbac\Exception\NotUniqueException |
|
200 | */ |
|
201 | public function testCheckAddingSameChildRoleDoubleTime() |
|
202 | { |
|
203 | $repositoryRegistry = $this->createRepositoryRegistry(); |
|
204 | ||
205 | /** @var Role $parent */ |
|
206 | $parent = $repositoryRegistry |
|
207 | ->getRoleRepository() |
|
208 | ->findOneBy(['name' => 'admin']); |
|
209 | ||
210 | /** @var Role $child */ |
|
211 | $child = $repositoryRegistry |
|
212 | ->getRoleRepository() |
|
213 | ->findOneBy(['name' => 'moderator']); |
|
214 | ||
215 | $this->authManager->addChildRole($parent, $child); |
|
216 | } |
|
217 | } |
|
218 |