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