|
@@ 80-86 (lines=7) @@
|
| 77 |
|
* @throws \Doctrine\ORM\Query\QueryException |
| 78 |
|
* @throws \Potievdev\SlimRbac\Exception\InvalidArgumentException |
| 79 |
|
*/ |
| 80 |
|
public function testCheckAccessSuccessCase() |
| 81 |
|
{ |
| 82 |
|
$middleware = new AuthMiddleware($this->authOptions); |
| 83 |
|
$request = $this->request->withAttribute($this->authOptions->getVariableName(), self::ADMIN_USER_ID); |
| 84 |
|
$response = $middleware->__invoke($request, $this->response, $this->callable); |
| 85 |
|
$this->assertEquals(200, $response->getStatusCode()); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
/** |
| 89 |
|
* @throws \Doctrine\ORM\Query\QueryException |
|
@@ 92-98 (lines=7) @@
|
| 89 |
|
* @throws \Doctrine\ORM\Query\QueryException |
| 90 |
|
* @throws \Potievdev\SlimRbac\Exception\InvalidArgumentException |
| 91 |
|
*/ |
| 92 |
|
public function testCheckAccessDeniedCase() |
| 93 |
|
{ |
| 94 |
|
$middleware = new AuthMiddleware($this->authOptions); |
| 95 |
|
$request = $this->request->withAttribute($this->authOptions->getVariableName(), self::MODERATOR_USER_ID); |
| 96 |
|
$response = $middleware->__invoke($request, $this->response, $this->callable); |
| 97 |
|
$this->assertEquals(403, $response->getStatusCode()); |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
/** |
| 101 |
|
* @throws \Doctrine\ORM\Query\QueryException |