diff options
Diffstat (limited to 'tests/front/controller/admin/SessionFilterControllerTest.php')
-rw-r--r-- | tests/front/controller/admin/SessionFilterControllerTest.php | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/tests/front/controller/admin/SessionFilterControllerTest.php b/tests/front/controller/admin/SessionFilterControllerTest.php index 7d5511ed..d306c6e9 100644 --- a/tests/front/controller/admin/SessionFilterControllerTest.php +++ b/tests/front/controller/admin/SessionFilterControllerTest.php | |||
@@ -174,55 +174,4 @@ class SessionFilterControllerTest extends TestCase | |||
174 | static::assertSame(302, $result->getStatusCode()); | 174 | static::assertSame(302, $result->getStatusCode()); |
175 | static::assertSame(['/subfolder/controller/?searchtag=abc'], $result->getHeader('location')); | 175 | static::assertSame(['/subfolder/controller/?searchtag=abc'], $result->getHeader('location')); |
176 | } | 176 | } |
177 | |||
178 | /** | ||
179 | * Untagged only - valid call | ||
180 | */ | ||
181 | public function testUntaggedOnly(): void | ||
182 | { | ||
183 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/subfolder/controller/?searchtag=abc']; | ||
184 | |||
185 | $request = $this->createMock(Request::class); | ||
186 | $response = new Response(); | ||
187 | |||
188 | $this->container->sessionManager | ||
189 | ->expects(static::once()) | ||
190 | ->method('setSessionParameter') | ||
191 | ->with(SessionManager::KEY_UNTAGGED_ONLY, true) | ||
192 | ; | ||
193 | |||
194 | $result = $this->controller->untaggedOnly($request, $response); | ||
195 | |||
196 | static::assertInstanceOf(Response::class, $result); | ||
197 | static::assertSame(302, $result->getStatusCode()); | ||
198 | static::assertSame(['/subfolder/controller/?searchtag=abc'], $result->getHeader('location')); | ||
199 | } | ||
200 | |||
201 | /** | ||
202 | * Untagged only - toggle off | ||
203 | */ | ||
204 | public function testUntaggedOnlyToggleOff(): void | ||
205 | { | ||
206 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/subfolder/controller/?searchtag=abc']; | ||
207 | |||
208 | $request = $this->createMock(Request::class); | ||
209 | $response = new Response(); | ||
210 | |||
211 | $this->container->sessionManager | ||
212 | ->method('getSessionParameter') | ||
213 | ->with(SessionManager::KEY_UNTAGGED_ONLY) | ||
214 | ->willReturn(true) | ||
215 | ; | ||
216 | $this->container->sessionManager | ||
217 | ->expects(static::once()) | ||
218 | ->method('setSessionParameter') | ||
219 | ->with(SessionManager::KEY_UNTAGGED_ONLY, false) | ||
220 | ; | ||
221 | |||
222 | $result = $this->controller->untaggedOnly($request, $response); | ||
223 | |||
224 | static::assertInstanceOf(Response::class, $result); | ||
225 | static::assertSame(302, $result->getStatusCode()); | ||
226 | static::assertSame(['/subfolder/controller/?searchtag=abc'], $result->getHeader('location')); | ||
227 | } | ||
228 | } | 177 | } |