|
@@ 99-107 (lines=9) @@
|
| 96 |
|
* @throws \Doctrine\ORM\Query\QueryException |
| 97 |
|
* @throws \Potievdev\SlimRbac\Exception\InvalidArgumentException |
| 98 |
|
*/ |
| 99 |
|
public function testReadingUserIdFromHeader() |
| 100 |
|
{ |
| 101 |
|
$authOptions = $this->authOptions; |
| 102 |
|
$authOptions->setVariableStorageType(AuthOptions::HEADER_STORAGE_TYPE); |
| 103 |
|
$middleware = new AuthMiddleware($authOptions); |
| 104 |
|
$request = $this->request->withHeader($authOptions->getVariableName(), self::ADMIN_USER_ID); |
| 105 |
|
$response = $middleware->__invoke($request, $this->response, $this->callable); |
| 106 |
|
$this->assertEquals(200, $response->getStatusCode()); |
| 107 |
|
} |
| 108 |
|
|
| 109 |
|
/** |
| 110 |
|
* @throws \Doctrine\ORM\Query\QueryException |
|
@@ 113-121 (lines=9) @@
|
| 110 |
|
* @throws \Doctrine\ORM\Query\QueryException |
| 111 |
|
* @throws \Potievdev\SlimRbac\Exception\InvalidArgumentException |
| 112 |
|
*/ |
| 113 |
|
public function testReadingUserIdFromCookie() |
| 114 |
|
{ |
| 115 |
|
$authOptions = $this->authOptions; |
| 116 |
|
$authOptions->setVariableStorageType(AuthOptions::COOKIE_STORAGE_TYPE); |
| 117 |
|
$middleware = new AuthMiddleware($authOptions); |
| 118 |
|
$request = $this->request->withCookieParams([$authOptions->getVariableName() => self::ADMIN_USER_ID]); |
| 119 |
|
$response = $middleware->__invoke($request, $this->response, $this->callable); |
| 120 |
|
$this->assertEquals(200, $response->getStatusCode()); |
| 121 |
|
} |
| 122 |
|
|
| 123 |
|
} |
| 124 |
|
|