aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/front
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-05-22 13:20:31 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commit2899ebb5b5e82890c877151f5c02045266ac9973 (patch)
tree0c4e2684c7f6d161f92a21181bfa4b2f78d6a82f /tests/front
parentaf290059d10319e76d1e7d78b592cab99c26d91a (diff)
downloadShaarli-2899ebb5b5e82890c877151f5c02045266ac9973.tar.gz
Shaarli-2899ebb5b5e82890c877151f5c02045266ac9973.tar.zst
Shaarli-2899ebb5b5e82890c877151f5c02045266ac9973.zip
Initialize admin Slim controllers
- Reorganize visitor controllers - Fix redirection with Slim's requests base path - Fix daily links
Diffstat (limited to 'tests/front')
-rw-r--r--tests/front/controller/admin/FrontAdminControllerMockHelper.php34
-rw-r--r--tests/front/controller/admin/LogoutControllerTest.php (renamed from tests/front/controller/LogoutControllerTest.php)4
-rw-r--r--tests/front/controller/admin/SessionFilterControllerTest.php (renamed from tests/front/controller/SessionFilterControllerTest.php)66
-rw-r--r--tests/front/controller/visitor/DailyControllerTest.php (renamed from tests/front/controller/DailyControllerTest.php)2
-rw-r--r--tests/front/controller/visitor/FeedControllerTest.php (renamed from tests/front/controller/FeedControllerTest.php)2
-rw-r--r--tests/front/controller/visitor/FrontControllerMockHelper.php (renamed from tests/front/controller/FrontControllerMockHelper.php)2
-rw-r--r--tests/front/controller/visitor/LoginControllerTest.php (renamed from tests/front/controller/LoginControllerTest.php)2
-rw-r--r--tests/front/controller/visitor/OpenSearchControllerTest.php (renamed from tests/front/controller/OpenSearchControllerTest.php)4
-rw-r--r--tests/front/controller/visitor/PictureWallControllerTest.php (renamed from tests/front/controller/PictureWallControllerTest.php)2
-rw-r--r--tests/front/controller/visitor/ShaarliPublicControllerTest.php (renamed from tests/front/controller/ShaarliControllerTest.php)42
-rw-r--r--tests/front/controller/visitor/TagCloudControllerTest.php (renamed from tests/front/controller/TagCloudControllerTest.php)2
-rw-r--r--tests/front/controller/visitor/TagControllerTest.php (renamed from tests/front/controller/TagControllerTest.php)5
12 files changed, 135 insertions, 32 deletions
diff --git a/tests/front/controller/admin/FrontAdminControllerMockHelper.php b/tests/front/controller/admin/FrontAdminControllerMockHelper.php
new file mode 100644
index 00000000..94581c09
--- /dev/null
+++ b/tests/front/controller/admin/FrontAdminControllerMockHelper.php
@@ -0,0 +1,34 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Shaarli\Front\Controller\Admin;
6
7use Shaarli\Container\ShaarliTestContainer;
8use Shaarli\Front\Controller\Visitor\FrontControllerMockHelper;
9use Shaarli\Security\LoginManager;
10
11/**
12 * Trait FrontControllerMockHelper
13 *
14 * Helper trait used to initialize the ShaarliContainer and mock its services for admin controller tests.
15 *
16 * @property ShaarliTestContainer $container
17 */
18trait FrontAdminControllerMockHelper
19{
20 use FrontControllerMockHelper {
21 FrontControllerMockHelper::createContainer as parentCreateContainer;
22 }
23
24 /**
25 * Mock the container instance
26 */
27 protected function createContainer(): void
28 {
29 $this->parentCreateContainer();
30
31 $this->container->loginManager = $this->createMock(LoginManager::class);
32 $this->container->loginManager->method('isLoggedIn')->willReturn(true);
33 }
34}
diff --git a/tests/front/controller/LogoutControllerTest.php b/tests/front/controller/admin/LogoutControllerTest.php
index 8e01c367..239e39b2 100644
--- a/tests/front/controller/LogoutControllerTest.php
+++ b/tests/front/controller/admin/LogoutControllerTest.php
@@ -2,7 +2,7 @@
2 2
3declare(strict_types=1); 3declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller; 5namespace Shaarli\Front\Controller\Admin;
6 6
7/** Override PHP builtin setcookie function in the local namespace to mock it... more or less */ 7/** Override PHP builtin setcookie function in the local namespace to mock it... more or less */
8if (!function_exists('Shaarli\Front\Controller\setcookie')) { 8if (!function_exists('Shaarli\Front\Controller\setcookie')) {
@@ -19,7 +19,7 @@ use Slim\Http\Response;
19 19
20class LogoutControllerTest extends TestCase 20class LogoutControllerTest extends TestCase
21{ 21{
22 use FrontControllerMockHelper; 22 use FrontAdminControllerMockHelper;
23 23
24 /** @var LogoutController */ 24 /** @var LogoutController */
25 protected $controller; 25 protected $controller;
diff --git a/tests/front/controller/SessionFilterControllerTest.php b/tests/front/controller/admin/SessionFilterControllerTest.php
index f541de03..f50f2fc2 100644
--- a/tests/front/controller/SessionFilterControllerTest.php
+++ b/tests/front/controller/admin/SessionFilterControllerTest.php
@@ -2,16 +2,18 @@
2 2
3declare(strict_types=1); 3declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase; 7use PHPUnit\Framework\TestCase;
8use Shaarli\Security\LoginManager;
8use Shaarli\Security\SessionManager; 9use Shaarli\Security\SessionManager;
9use Slim\Http\Request; 10use Slim\Http\Request;
10use Slim\Http\Response; 11use Slim\Http\Response;
12use Slim\Http\Uri;
11 13
12class SessionFilterControllerTest extends TestCase 14class SessionFilterControllerTest extends TestCase
13{ 15{
14 use FrontControllerMockHelper; 16 use FrontAdminControllerMockHelper;
15 17
16 /** @var SessionFilterController */ 18 /** @var SessionFilterController */
17 protected $controller; 19 protected $controller;
@@ -33,6 +35,12 @@ class SessionFilterControllerTest extends TestCase
33 $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/subfolder/controller/?searchtag=abc']; 35 $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/subfolder/controller/?searchtag=abc'];
34 36
35 $request = $this->createMock(Request::class); 37 $request = $this->createMock(Request::class);
38 $request->method('getUri')->willReturnCallback(function (): Uri {
39 $uri = $this->createMock(Uri::class);
40 $uri->method('getBasePath')->willReturn('/subfolder');
41
42 return $uri;
43 });
36 $request->method('getParam')->with('nb')->willReturn('8'); 44 $request->method('getParam')->with('nb')->willReturn('8');
37 $response = new Response(); 45 $response = new Response();
38 46
@@ -57,6 +65,12 @@ class SessionFilterControllerTest extends TestCase
57 $this->createValidContainerMockSet(); 65 $this->createValidContainerMockSet();
58 66
59 $request = $this->createMock(Request::class); 67 $request = $this->createMock(Request::class);
68 $request->method('getUri')->willReturnCallback(function (): Uri {
69 $uri = $this->createMock(Uri::class);
70 $uri->method('getBasePath')->willReturn('/subfolder');
71
72 return $uri;
73 });
60 $request->method('getParam')->with('nb')->willReturn('test'); 74 $request->method('getParam')->with('nb')->willReturn('test');
61 $response = new Response(); 75 $response = new Response();
62 76
@@ -70,7 +84,7 @@ class SessionFilterControllerTest extends TestCase
70 84
71 static::assertInstanceOf(Response::class, $result); 85 static::assertInstanceOf(Response::class, $result);
72 static::assertSame(302, $result->getStatusCode()); 86 static::assertSame(302, $result->getStatusCode());
73 static::assertSame(['./'], $result->getHeader('location')); 87 static::assertSame(['/subfolder'], $result->getHeader('location'));
74 } 88 }
75 89
76 /** 90 /**
@@ -92,6 +106,12 @@ class SessionFilterControllerTest extends TestCase
92 ; 106 ;
93 107
94 $request = $this->createMock(Request::class); 108 $request = $this->createMock(Request::class);
109 $request->method('getUri')->willReturnCallback(function (): Uri {
110 $uri = $this->createMock(Uri::class);
111 $uri->method('getBasePath')->willReturn('/subfolder');
112
113 return $uri;
114 });
95 $response = new Response(); 115 $response = new Response();
96 116
97 $result = $this->controller->visibility($request, $response, $arg); 117 $result = $this->controller->visibility($request, $response, $arg);
@@ -129,6 +149,12 @@ class SessionFilterControllerTest extends TestCase
129 ; 149 ;
130 150
131 $request = $this->createMock(Request::class); 151 $request = $this->createMock(Request::class);
152 $request->method('getUri')->willReturnCallback(function (): Uri {
153 $uri = $this->createMock(Uri::class);
154 $uri->method('getBasePath')->willReturn('/subfolder');
155
156 return $uri;
157 });
132 $response = new Response(); 158 $response = new Response();
133 159
134 $result = $this->controller->visibility($request, $response, $arg); 160 $result = $this->controller->visibility($request, $response, $arg);
@@ -160,13 +186,19 @@ class SessionFilterControllerTest extends TestCase
160 ; 186 ;
161 187
162 $request = $this->createMock(Request::class); 188 $request = $this->createMock(Request::class);
189 $request->method('getUri')->willReturnCallback(function (): Uri {
190 $uri = $this->createMock(Uri::class);
191 $uri->method('getBasePath')->willReturn('/subfolder');
192
193 return $uri;
194 });
163 $response = new Response(); 195 $response = new Response();
164 196
165 $result = $this->controller->visibility($request, $response, $arg); 197 $result = $this->controller->visibility($request, $response, $arg);
166 198
167 static::assertInstanceOf(Response::class, $result); 199 static::assertInstanceOf(Response::class, $result);
168 static::assertSame(302, $result->getStatusCode()); 200 static::assertSame(302, $result->getStatusCode());
169 static::assertSame(['./'], $result->getHeader('location')); 201 static::assertSame(['/subfolder'], $result->getHeader('location'));
170 } 202 }
171 203
172 /** 204 /**
@@ -192,6 +224,12 @@ class SessionFilterControllerTest extends TestCase
192 ; 224 ;
193 225
194 $request = $this->createMock(Request::class); 226 $request = $this->createMock(Request::class);
227 $request->method('getUri')->willReturnCallback(function (): Uri {
228 $uri = $this->createMock(Uri::class);
229 $uri->method('getBasePath')->willReturn('/subfolder');
230
231 return $uri;
232 });
195 $response = new Response(); 233 $response = new Response();
196 234
197 $result = $this->controller->visibility($request, $response, $arg); 235 $result = $this->controller->visibility($request, $response, $arg);
@@ -212,6 +250,7 @@ class SessionFilterControllerTest extends TestCase
212 250
213 $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/subfolder/controller/?searchtag=abc']; 251 $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/subfolder/controller/?searchtag=abc'];
214 252
253 $this->container->loginManager = $this->createMock(LoginManager::class);
215 $this->container->loginManager->method('isLoggedIn')->willReturn(false); 254 $this->container->loginManager->method('isLoggedIn')->willReturn(false);
216 $this->container->sessionManager 255 $this->container->sessionManager
217 ->expects(static::never()) 256 ->expects(static::never())
@@ -224,6 +263,12 @@ class SessionFilterControllerTest extends TestCase
224 ; 263 ;
225 264
226 $request = $this->createMock(Request::class); 265 $request = $this->createMock(Request::class);
266 $request->method('getUri')->willReturnCallback(function (): Uri {
267 $uri = $this->createMock(Uri::class);
268 $uri->method('getBasePath')->willReturn('/subfolder');
269
270 return $uri;
271 });
227 $response = new Response(); 272 $response = new Response();
228 273
229 $result = $this->controller->visibility($request, $response, $arg); 274 $result = $this->controller->visibility($request, $response, $arg);
@@ -243,6 +288,12 @@ class SessionFilterControllerTest extends TestCase
243 $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/subfolder/controller/?searchtag=abc']; 288 $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/subfolder/controller/?searchtag=abc'];
244 289
245 $request = $this->createMock(Request::class); 290 $request = $this->createMock(Request::class);
291 $request->method('getUri')->willReturnCallback(function (): Uri {
292 $uri = $this->createMock(Uri::class);
293 $uri->method('getBasePath')->willReturn('/subfolder');
294
295 return $uri;
296 });
246 $response = new Response(); 297 $response = new Response();
247 298
248 $this->container->sessionManager 299 $this->container->sessionManager
@@ -268,6 +319,13 @@ class SessionFilterControllerTest extends TestCase
268 $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/subfolder/controller/?searchtag=abc']; 319 $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/subfolder/controller/?searchtag=abc'];
269 320
270 $request = $this->createMock(Request::class); 321 $request = $this->createMock(Request::class);
322 $request->method('getUri')->willReturnCallback(function (): Uri {
323 $uri = $this->createMock(Uri::class);
324 $uri->method('getBasePath')->willReturn('/subfolder');
325
326 return $uri;
327 });
328
271 $response = new Response(); 329 $response = new Response();
272 330
273 $this->container->sessionManager 331 $this->container->sessionManager
diff --git a/tests/front/controller/DailyControllerTest.php b/tests/front/controller/visitor/DailyControllerTest.php
index 7ec99030..6ff769fc 100644
--- a/tests/front/controller/DailyControllerTest.php
+++ b/tests/front/controller/visitor/DailyControllerTest.php
@@ -2,7 +2,7 @@
2 2
3declare(strict_types=1); 3declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase; 7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 8use Shaarli\Bookmark\Bookmark;
diff --git a/tests/front/controller/FeedControllerTest.php b/tests/front/controller/visitor/FeedControllerTest.php
index 7e8657e2..fd4679ea 100644
--- a/tests/front/controller/FeedControllerTest.php
+++ b/tests/front/controller/visitor/FeedControllerTest.php
@@ -2,7 +2,7 @@
2 2
3declare(strict_types=1); 3declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase; 7use PHPUnit\Framework\TestCase;
8use Shaarli\Feed\FeedBuilder; 8use Shaarli\Feed\FeedBuilder;
diff --git a/tests/front/controller/FrontControllerMockHelper.php b/tests/front/controller/visitor/FrontControllerMockHelper.php
index b65607e7..bc3266b5 100644
--- a/tests/front/controller/FrontControllerMockHelper.php
+++ b/tests/front/controller/visitor/FrontControllerMockHelper.php
@@ -2,7 +2,7 @@
2 2
3declare(strict_types=1); 3declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\MockObject\MockObject; 7use PHPUnit\Framework\MockObject\MockObject;
8use Shaarli\Bookmark\BookmarkServiceInterface; 8use Shaarli\Bookmark\BookmarkServiceInterface;
diff --git a/tests/front/controller/LoginControllerTest.php b/tests/front/controller/visitor/LoginControllerTest.php
index 21937f3c..9d223316 100644
--- a/tests/front/controller/LoginControllerTest.php
+++ b/tests/front/controller/visitor/LoginControllerTest.php
@@ -2,7 +2,7 @@
2 2
3declare(strict_types=1); 3declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase; 7use PHPUnit\Framework\TestCase;
8use Shaarli\Config\ConfigManager; 8use Shaarli\Config\ConfigManager;
diff --git a/tests/front/controller/OpenSearchControllerTest.php b/tests/front/controller/visitor/OpenSearchControllerTest.php
index f3b6f439..52475318 100644
--- a/tests/front/controller/OpenSearchControllerTest.php
+++ b/tests/front/controller/visitor/OpenSearchControllerTest.php
@@ -2,11 +2,9 @@
2 2
3declare(strict_types=1); 3declare(strict_types=1);
4 4
5namespace front\controller; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase; 7use PHPUnit\Framework\TestCase;
8use Shaarli\Front\Controller\FrontControllerMockHelper;
9use Shaarli\Front\Controller\OpenSearchController;
10use Slim\Http\Request; 8use Slim\Http\Request;
11use Slim\Http\Response; 9use Slim\Http\Response;
12 10
diff --git a/tests/front/controller/PictureWallControllerTest.php b/tests/front/controller/visitor/PictureWallControllerTest.php
index 8160bb38..7ac842cb 100644
--- a/tests/front/controller/PictureWallControllerTest.php
+++ b/tests/front/controller/visitor/PictureWallControllerTest.php
@@ -2,7 +2,7 @@
2 2
3declare(strict_types=1); 3declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase; 7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 8use Shaarli\Bookmark\Bookmark;
diff --git a/tests/front/controller/ShaarliControllerTest.php b/tests/front/controller/visitor/ShaarliPublicControllerTest.php
index a6011b49..e2e88da3 100644
--- a/tests/front/controller/ShaarliControllerTest.php
+++ b/tests/front/controller/visitor/ShaarliPublicControllerTest.php
@@ -2,11 +2,13 @@
2 2
3declare(strict_types=1); 3declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase; 7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\BookmarkFilter; 8use Shaarli\Bookmark\BookmarkFilter;
9use Slim\Http\Request;
9use Slim\Http\Response; 10use Slim\Http\Response;
11use Slim\Http\Uri;
10 12
11/** 13/**
12 * Class ShaarliControllerTest 14 * Class ShaarliControllerTest
@@ -24,13 +26,16 @@ class ShaarliControllerTest extends TestCase
24 /** @var mixed[] List of variable assigned to the template */ 26 /** @var mixed[] List of variable assigned to the template */
25 protected $assignedValues; 27 protected $assignedValues;
26 28
29 /** @var Request */
30 protected $request;
31
27 public function setUp(): void 32 public function setUp(): void
28 { 33 {
29 $this->createContainer(); 34 $this->createContainer();
30 35
31 $this->controller = new class($this->container) extends ShaarliController 36 $this->controller = new class($this->container) extends ShaarliVisitorController
32 { 37 {
33 public function assignView(string $key, $value): ShaarliController 38 public function assignView(string $key, $value): ShaarliVisitorController
34 { 39 {
35 return parent::assignView($key, $value); 40 return parent::assignView($key, $value);
36 } 41 }
@@ -41,14 +46,23 @@ class ShaarliControllerTest extends TestCase
41 } 46 }
42 47
43 public function redirectFromReferer( 48 public function redirectFromReferer(
49 Request $request,
44 Response $response, 50 Response $response,
45 array $loopTerms = [], 51 array $loopTerms = [],
46 array $clearParams = [] 52 array $clearParams = []
47 ): Response { 53 ): Response {
48 return parent::redirectFromReferer($response, $loopTerms, $clearParams); 54 return parent::redirectFromReferer($request, $response, $loopTerms, $clearParams);
49 } 55 }
50 }; 56 };
51 $this->assignedValues = []; 57 $this->assignedValues = [];
58
59 $this->request = $this->createMock(Request::class);
60 $this->request->method('getUri')->willReturnCallback(function (): Uri {
61 $uri = $this->createMock(Uri::class);
62 $uri->method('getBasePath')->willReturn('/subfolder');
63
64 return $uri;
65 });
52 } 66 }
53 67
54 public function testAssignView(): void 68 public function testAssignView(): void
@@ -59,7 +73,7 @@ class ShaarliControllerTest extends TestCase
59 73
60 $self = $this->controller->assignView('variableName', 'variableValue'); 74 $self = $this->controller->assignView('variableName', 'variableValue');
61 75
62 static::assertInstanceOf(ShaarliController::class, $self); 76 static::assertInstanceOf(ShaarliVisitorController::class, $self);
63 static::assertSame('variableValue', $this->assignedValues['variableName']); 77 static::assertSame('variableValue', $this->assignedValues['variableName']);
64 } 78 }
65 79
@@ -112,7 +126,7 @@ class ShaarliControllerTest extends TestCase
112 126
113 $response = new Response(); 127 $response = new Response();
114 128
115 $result = $this->controller->redirectFromReferer($response); 129 $result = $this->controller->redirectFromReferer($this->request, $response);
116 130
117 static::assertSame(302, $result->getStatusCode()); 131 static::assertSame(302, $result->getStatusCode());
118 static::assertSame(['/subfolder/controller?query=param&other=2'], $result->getHeader('location')); 132 static::assertSame(['/subfolder/controller?query=param&other=2'], $result->getHeader('location'));
@@ -129,7 +143,7 @@ class ShaarliControllerTest extends TestCase
129 143
130 $response = new Response(); 144 $response = new Response();
131 145
132 $result = $this->controller->redirectFromReferer($response, ['nope']); 146 $result = $this->controller->redirectFromReferer($this->request, $response, ['nope']);
133 147
134 static::assertSame(302, $result->getStatusCode()); 148 static::assertSame(302, $result->getStatusCode());
135 static::assertSame(['/subfolder/controller?query=param&other=2'], $result->getHeader('location')); 149 static::assertSame(['/subfolder/controller?query=param&other=2'], $result->getHeader('location'));
@@ -146,10 +160,10 @@ class ShaarliControllerTest extends TestCase
146 160
147 $response = new Response(); 161 $response = new Response();
148 162
149 $result = $this->controller->redirectFromReferer($response, ['nope', 'controller']); 163 $result = $this->controller->redirectFromReferer($this->request, $response, ['nope', 'controller']);
150 164
151 static::assertSame(302, $result->getStatusCode()); 165 static::assertSame(302, $result->getStatusCode());
152 static::assertSame(['./'], $result->getHeader('location')); 166 static::assertSame(['/subfolder'], $result->getHeader('location'));
153 } 167 }
154 168
155 /** 169 /**
@@ -163,10 +177,10 @@ class ShaarliControllerTest extends TestCase
163 177
164 $response = new Response(); 178 $response = new Response();
165 179
166 $result = $this->controller->redirectFromReferer($response, ['nope', 'other']); 180 $result = $this->controller->redirectFromReferer($this->request, $response, ['nope', 'other']);
167 181
168 static::assertSame(302, $result->getStatusCode()); 182 static::assertSame(302, $result->getStatusCode());
169 static::assertSame(['./'], $result->getHeader('location')); 183 static::assertSame(['/subfolder'], $result->getHeader('location'));
170 } 184 }
171 185
172 /** 186 /**
@@ -181,7 +195,7 @@ class ShaarliControllerTest extends TestCase
181 195
182 $response = new Response(); 196 $response = new Response();
183 197
184 $result = $this->controller->redirectFromReferer($response, ['nope', 'param']); 198 $result = $this->controller->redirectFromReferer($this->request, $response, ['nope', 'param']);
185 199
186 static::assertSame(302, $result->getStatusCode()); 200 static::assertSame(302, $result->getStatusCode());
187 static::assertSame(['/subfolder/controller?query=param&other=2'], $result->getHeader('location')); 201 static::assertSame(['/subfolder/controller?query=param&other=2'], $result->getHeader('location'));
@@ -199,7 +213,7 @@ class ShaarliControllerTest extends TestCase
199 213
200 $response = new Response(); 214 $response = new Response();
201 215
202 $result = $this->controller->redirectFromReferer($response, ['shaarli']); 216 $result = $this->controller->redirectFromReferer($this->request, $response, ['shaarli']);
203 217
204 static::assertSame(302, $result->getStatusCode()); 218 static::assertSame(302, $result->getStatusCode());
205 static::assertSame(['/subfolder/controller?query=param&other=2'], $result->getHeader('location')); 219 static::assertSame(['/subfolder/controller?query=param&other=2'], $result->getHeader('location'));
@@ -217,7 +231,7 @@ class ShaarliControllerTest extends TestCase
217 231
218 $response = new Response(); 232 $response = new Response();
219 233
220 $result = $this->controller->redirectFromReferer($response, ['query'], ['query']); 234 $result = $this->controller->redirectFromReferer($this->request, $response, ['query'], ['query']);
221 235
222 static::assertSame(302, $result->getStatusCode()); 236 static::assertSame(302, $result->getStatusCode());
223 static::assertSame(['/subfolder/controller?other=2'], $result->getHeader('location')); 237 static::assertSame(['/subfolder/controller?other=2'], $result->getHeader('location'));
diff --git a/tests/front/controller/TagCloudControllerTest.php b/tests/front/controller/visitor/TagCloudControllerTest.php
index 8c27900d..e636d496 100644
--- a/tests/front/controller/TagCloudControllerTest.php
+++ b/tests/front/controller/visitor/TagCloudControllerTest.php
@@ -2,7 +2,7 @@
2 2
3declare(strict_types=1); 3declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase; 7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\BookmarkFilter; 8use Shaarli\Bookmark\BookmarkFilter;
diff --git a/tests/front/controller/TagControllerTest.php b/tests/front/controller/visitor/TagControllerTest.php
index 2184cb11..9a2b1f71 100644
--- a/tests/front/controller/TagControllerTest.php
+++ b/tests/front/controller/visitor/TagControllerTest.php
@@ -2,7 +2,7 @@
2 2
3declare(strict_types=1); 3declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase; 7use PHPUnit\Framework\TestCase;
8use Slim\Http\Request; 8use Slim\Http\Request;
@@ -12,8 +12,7 @@ class TagControllerTest extends TestCase
12{ 12{
13 use FrontControllerMockHelper; 13 use FrontControllerMockHelper;
14 14
15 /** @var TagController */ 15 /** @var TagController */ protected $controller;
16 protected $controller;
17 16
18 public function setUp(): void 17 public function setUp(): void
19 { 18 {