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