diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-05-27 13:35:48 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-23 21:19:21 +0200 |
commit | ef00f9d2033f6de11e71bf3a909399cae6f73a9f (patch) | |
tree | 96f47312084bab73be34495eed4280110a8ff258 /tests/front/controller/visitor | |
parent | ba43064ddb7771fc97df135a32f9b0d5e373dd36 (diff) | |
download | Shaarli-ef00f9d2033f6de11e71bf3a909399cae6f73a9f.tar.gz Shaarli-ef00f9d2033f6de11e71bf3a909399cae6f73a9f.tar.zst Shaarli-ef00f9d2033f6de11e71bf3a909399cae6f73a9f.zip |
Process password change controller through Slim
Diffstat (limited to 'tests/front/controller/visitor')
9 files changed, 1 insertions, 99 deletions
diff --git a/tests/front/controller/visitor/DailyControllerTest.php b/tests/front/controller/visitor/DailyControllerTest.php index 6ff769fc..872420fd 100644 --- a/tests/front/controller/visitor/DailyControllerTest.php +++ b/tests/front/controller/visitor/DailyControllerTest.php | |||
@@ -27,8 +27,6 @@ class DailyControllerTest extends TestCase | |||
27 | 27 | ||
28 | public function testValidIndexControllerInvokeDefault(): void | 28 | public function testValidIndexControllerInvokeDefault(): void |
29 | { | 29 | { |
30 | $this->createValidContainerMockSet(); | ||
31 | |||
32 | $currentDay = new \DateTimeImmutable('2020-05-13'); | 30 | $currentDay = new \DateTimeImmutable('2020-05-13'); |
33 | 31 | ||
34 | $request = $this->createMock(Request::class); | 32 | $request = $this->createMock(Request::class); |
@@ -169,8 +167,6 @@ class DailyControllerTest extends TestCase | |||
169 | */ | 167 | */ |
170 | public function testValidIndexControllerInvokeNoFutureOrPast(): void | 168 | public function testValidIndexControllerInvokeNoFutureOrPast(): void |
171 | { | 169 | { |
172 | $this->createValidContainerMockSet(); | ||
173 | |||
174 | $currentDay = new \DateTimeImmutable('2020-05-13'); | 170 | $currentDay = new \DateTimeImmutable('2020-05-13'); |
175 | 171 | ||
176 | $request = $this->createMock(Request::class); | 172 | $request = $this->createMock(Request::class); |
@@ -243,8 +239,6 @@ class DailyControllerTest extends TestCase | |||
243 | */ | 239 | */ |
244 | public function testValidIndexControllerInvokeHeightAdjustment(): void | 240 | public function testValidIndexControllerInvokeHeightAdjustment(): void |
245 | { | 241 | { |
246 | $this->createValidContainerMockSet(); | ||
247 | |||
248 | $currentDay = new \DateTimeImmutable('2020-05-13'); | 242 | $currentDay = new \DateTimeImmutable('2020-05-13'); |
249 | 243 | ||
250 | $request = $this->createMock(Request::class); | 244 | $request = $this->createMock(Request::class); |
@@ -314,8 +308,6 @@ class DailyControllerTest extends TestCase | |||
314 | */ | 308 | */ |
315 | public function testValidIndexControllerInvokeNoBookmark(): void | 309 | public function testValidIndexControllerInvokeNoBookmark(): void |
316 | { | 310 | { |
317 | $this->createValidContainerMockSet(); | ||
318 | |||
319 | $request = $this->createMock(Request::class); | 311 | $request = $this->createMock(Request::class); |
320 | $response = new Response(); | 312 | $response = new Response(); |
321 | 313 | ||
@@ -363,8 +355,6 @@ class DailyControllerTest extends TestCase | |||
363 | */ | 355 | */ |
364 | public function testValidRssControllerInvokeDefault(): void | 356 | public function testValidRssControllerInvokeDefault(): void |
365 | { | 357 | { |
366 | $this->createValidContainerMockSet(); | ||
367 | |||
368 | $dates = [ | 358 | $dates = [ |
369 | new \DateTimeImmutable('2020-05-17'), | 359 | new \DateTimeImmutable('2020-05-17'), |
370 | new \DateTimeImmutable('2020-05-15'), | 360 | new \DateTimeImmutable('2020-05-15'), |
@@ -439,8 +429,6 @@ class DailyControllerTest extends TestCase | |||
439 | */ | 429 | */ |
440 | public function testValidRssControllerInvokeTriggerCache(): void | 430 | public function testValidRssControllerInvokeTriggerCache(): void |
441 | { | 431 | { |
442 | $this->createValidContainerMockSet(); | ||
443 | |||
444 | $request = $this->createMock(Request::class); | 432 | $request = $this->createMock(Request::class); |
445 | $response = new Response(); | 433 | $response = new Response(); |
446 | 434 | ||
@@ -465,8 +453,6 @@ class DailyControllerTest extends TestCase | |||
465 | */ | 453 | */ |
466 | public function testValidRssControllerInvokeNoBookmark(): void | 454 | public function testValidRssControllerInvokeNoBookmark(): void |
467 | { | 455 | { |
468 | $this->createValidContainerMockSet(); | ||
469 | |||
470 | $request = $this->createMock(Request::class); | 456 | $request = $this->createMock(Request::class); |
471 | $response = new Response(); | 457 | $response = new Response(); |
472 | 458 | ||
diff --git a/tests/front/controller/visitor/FeedControllerTest.php b/tests/front/controller/visitor/FeedControllerTest.php index fd4679ea..fb417e2a 100644 --- a/tests/front/controller/visitor/FeedControllerTest.php +++ b/tests/front/controller/visitor/FeedControllerTest.php | |||
@@ -30,8 +30,6 @@ class FeedControllerTest extends TestCase | |||
30 | */ | 30 | */ |
31 | public function testDefaultRssController(): void | 31 | public function testDefaultRssController(): void |
32 | { | 32 | { |
33 | $this->createValidContainerMockSet(); | ||
34 | |||
35 | $request = $this->createMock(Request::class); | 33 | $request = $this->createMock(Request::class); |
36 | $response = new Response(); | 34 | $response = new Response(); |
37 | 35 | ||
@@ -71,8 +69,6 @@ class FeedControllerTest extends TestCase | |||
71 | */ | 69 | */ |
72 | public function testDefaultAtomController(): void | 70 | public function testDefaultAtomController(): void |
73 | { | 71 | { |
74 | $this->createValidContainerMockSet(); | ||
75 | |||
76 | $request = $this->createMock(Request::class); | 72 | $request = $this->createMock(Request::class); |
77 | $response = new Response(); | 73 | $response = new Response(); |
78 | 74 | ||
@@ -112,8 +108,6 @@ class FeedControllerTest extends TestCase | |||
112 | */ | 108 | */ |
113 | public function testAtomControllerWithParameters(): void | 109 | public function testAtomControllerWithParameters(): void |
114 | { | 110 | { |
115 | $this->createValidContainerMockSet(); | ||
116 | |||
117 | $request = $this->createMock(Request::class); | 111 | $request = $this->createMock(Request::class); |
118 | $request->method('getParams')->willReturn(['parameter' => 'value']); | 112 | $request->method('getParams')->willReturn(['parameter' => 'value']); |
119 | $response = new Response(); | 113 | $response = new Response(); |
diff --git a/tests/front/controller/visitor/FrontControllerMockHelper.php b/tests/front/controller/visitor/FrontControllerMockHelper.php index bc3266b5..d16b6949 100644 --- a/tests/front/controller/visitor/FrontControllerMockHelper.php +++ b/tests/front/controller/visitor/FrontControllerMockHelper.php | |||
@@ -31,18 +31,12 @@ trait FrontControllerMockHelper | |||
31 | protected $container; | 31 | protected $container; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Mock the container instance | 34 | * Mock the container instance and initialize container's services used by tests |
35 | */ | 35 | */ |
36 | protected function createContainer(): void | 36 | protected function createContainer(): void |
37 | { | 37 | { |
38 | $this->container = $this->createMock(ShaarliTestContainer::class); | 38 | $this->container = $this->createMock(ShaarliTestContainer::class); |
39 | } | ||
40 | 39 | ||
41 | /** | ||
42 | * Initialize container's services used by tests | ||
43 | */ | ||
44 | protected function createValidContainerMockSet(): void | ||
45 | { | ||
46 | $this->container->loginManager = $this->createMock(LoginManager::class); | 40 | $this->container->loginManager = $this->createMock(LoginManager::class); |
47 | 41 | ||
48 | // Config | 42 | // Config |
diff --git a/tests/front/controller/visitor/LoginControllerTest.php b/tests/front/controller/visitor/LoginControllerTest.php index 9d223316..faa8ac71 100644 --- a/tests/front/controller/visitor/LoginControllerTest.php +++ b/tests/front/controller/visitor/LoginControllerTest.php | |||
@@ -26,8 +26,6 @@ class LoginControllerTest extends TestCase | |||
26 | 26 | ||
27 | public function testValidControllerInvoke(): void | 27 | public function testValidControllerInvoke(): void |
28 | { | 28 | { |
29 | $this->createValidContainerMockSet(); | ||
30 | |||
31 | $request = $this->createMock(Request::class); | 29 | $request = $this->createMock(Request::class); |
32 | $request->expects(static::once())->method('getServerParam')->willReturn('> referer'); | 30 | $request->expects(static::once())->method('getServerParam')->willReturn('> referer'); |
33 | $response = new Response(); | 31 | $response = new Response(); |
@@ -57,8 +55,6 @@ class LoginControllerTest extends TestCase | |||
57 | 55 | ||
58 | public function testValidControllerInvokeWithUserName(): void | 56 | public function testValidControllerInvokeWithUserName(): void |
59 | { | 57 | { |
60 | $this->createValidContainerMockSet(); | ||
61 | |||
62 | $request = $this->createMock(Request::class); | 58 | $request = $this->createMock(Request::class); |
63 | $request->expects(static::once())->method('getServerParam')->willReturn('> referer'); | 59 | $request->expects(static::once())->method('getServerParam')->willReturn('> referer'); |
64 | $request->expects(static::exactly(2))->method('getParam')->willReturn('myUser>'); | 60 | $request->expects(static::exactly(2))->method('getParam')->willReturn('myUser>'); |
@@ -90,8 +86,6 @@ class LoginControllerTest extends TestCase | |||
90 | 86 | ||
91 | public function testLoginControllerWhileLoggedIn(): void | 87 | public function testLoginControllerWhileLoggedIn(): void |
92 | { | 88 | { |
93 | $this->createValidContainerMockSet(); | ||
94 | |||
95 | $request = $this->createMock(Request::class); | 89 | $request = $this->createMock(Request::class); |
96 | $response = new Response(); | 90 | $response = new Response(); |
97 | 91 | ||
@@ -106,8 +100,6 @@ class LoginControllerTest extends TestCase | |||
106 | 100 | ||
107 | public function testLoginControllerOpenShaarli(): void | 101 | public function testLoginControllerOpenShaarli(): void |
108 | { | 102 | { |
109 | $this->createValidContainerMockSet(); | ||
110 | |||
111 | $request = $this->createMock(Request::class); | 103 | $request = $this->createMock(Request::class); |
112 | $response = new Response(); | 104 | $response = new Response(); |
113 | 105 | ||
@@ -129,8 +121,6 @@ class LoginControllerTest extends TestCase | |||
129 | 121 | ||
130 | public function testLoginControllerWhileBanned(): void | 122 | public function testLoginControllerWhileBanned(): void |
131 | { | 123 | { |
132 | $this->createValidContainerMockSet(); | ||
133 | |||
134 | $request = $this->createMock(Request::class); | 124 | $request = $this->createMock(Request::class); |
135 | $response = new Response(); | 125 | $response = new Response(); |
136 | 126 | ||
diff --git a/tests/front/controller/visitor/OpenSearchControllerTest.php b/tests/front/controller/visitor/OpenSearchControllerTest.php index 52475318..5f9f5b12 100644 --- a/tests/front/controller/visitor/OpenSearchControllerTest.php +++ b/tests/front/controller/visitor/OpenSearchControllerTest.php | |||
@@ -24,8 +24,6 @@ class OpenSearchControllerTest extends TestCase | |||
24 | 24 | ||
25 | public function testOpenSearchController(): void | 25 | public function testOpenSearchController(): void |
26 | { | 26 | { |
27 | $this->createValidContainerMockSet(); | ||
28 | |||
29 | $request = $this->createMock(Request::class); | 27 | $request = $this->createMock(Request::class); |
30 | $response = new Response(); | 28 | $response = new Response(); |
31 | 29 | ||
diff --git a/tests/front/controller/visitor/PictureWallControllerTest.php b/tests/front/controller/visitor/PictureWallControllerTest.php index 7ac842cb..3dc3f292 100644 --- a/tests/front/controller/visitor/PictureWallControllerTest.php +++ b/tests/front/controller/visitor/PictureWallControllerTest.php | |||
@@ -28,8 +28,6 @@ class PictureWallControllerTest extends TestCase | |||
28 | 28 | ||
29 | public function testValidControllerInvokeDefault(): void | 29 | public function testValidControllerInvokeDefault(): void |
30 | { | 30 | { |
31 | $this->createValidContainerMockSet(); | ||
32 | |||
33 | $request = $this->createMock(Request::class); | 31 | $request = $this->createMock(Request::class); |
34 | $request->expects(static::once())->method('getQueryParams')->willReturn([]); | 32 | $request->expects(static::once())->method('getQueryParams')->willReturn([]); |
35 | $response = new Response(); | 33 | $response = new Response(); |
@@ -106,8 +104,6 @@ class PictureWallControllerTest extends TestCase | |||
106 | { | 104 | { |
107 | $this->expectException(ThumbnailsDisabledException::class); | 105 | $this->expectException(ThumbnailsDisabledException::class); |
108 | 106 | ||
109 | $this->createValidContainerMockSet(); | ||
110 | |||
111 | $request = $this->createMock(Request::class); | 107 | $request = $this->createMock(Request::class); |
112 | $response = new Response(); | 108 | $response = new Response(); |
113 | 109 | ||
diff --git a/tests/front/controller/visitor/ShaarliPublicControllerTest.php b/tests/front/controller/visitor/ShaarliPublicControllerTest.php index e2e88da3..1f7d57ad 100644 --- a/tests/front/controller/visitor/ShaarliPublicControllerTest.php +++ b/tests/front/controller/visitor/ShaarliPublicControllerTest.php | |||
@@ -67,8 +67,6 @@ class ShaarliControllerTest extends TestCase | |||
67 | 67 | ||
68 | public function testAssignView(): void | 68 | public function testAssignView(): void |
69 | { | 69 | { |
70 | $this->createValidContainerMockSet(); | ||
71 | |||
72 | $this->assignTemplateVars($this->assignedValues); | 70 | $this->assignTemplateVars($this->assignedValues); |
73 | 71 | ||
74 | $self = $this->controller->assignView('variableName', 'variableValue'); | 72 | $self = $this->controller->assignView('variableName', 'variableValue'); |
@@ -79,8 +77,6 @@ class ShaarliControllerTest extends TestCase | |||
79 | 77 | ||
80 | public function testRender(): void | 78 | public function testRender(): void |
81 | { | 79 | { |
82 | $this->createValidContainerMockSet(); | ||
83 | |||
84 | $this->assignTemplateVars($this->assignedValues); | 80 | $this->assignTemplateVars($this->assignedValues); |
85 | 81 | ||
86 | $this->container->bookmarkService | 82 | $this->container->bookmarkService |
@@ -120,8 +116,6 @@ class ShaarliControllerTest extends TestCase | |||
120 | */ | 116 | */ |
121 | public function testRedirectFromRefererDefault(): void | 117 | public function testRedirectFromRefererDefault(): void |
122 | { | 118 | { |
123 | $this->createValidContainerMockSet(); | ||
124 | |||
125 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; | 119 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; |
126 | 120 | ||
127 | $response = new Response(); | 121 | $response = new Response(); |
@@ -137,8 +131,6 @@ class ShaarliControllerTest extends TestCase | |||
137 | */ | 131 | */ |
138 | public function testRedirectFromRefererWithUnmatchedLoopTerm(): void | 132 | public function testRedirectFromRefererWithUnmatchedLoopTerm(): void |
139 | { | 133 | { |
140 | $this->createValidContainerMockSet(); | ||
141 | |||
142 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; | 134 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; |
143 | 135 | ||
144 | $response = new Response(); | 136 | $response = new Response(); |
@@ -154,8 +146,6 @@ class ShaarliControllerTest extends TestCase | |||
154 | */ | 146 | */ |
155 | public function testRedirectFromRefererWithMatchingLoopTermInPath(): void | 147 | public function testRedirectFromRefererWithMatchingLoopTermInPath(): void |
156 | { | 148 | { |
157 | $this->createValidContainerMockSet(); | ||
158 | |||
159 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; | 149 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; |
160 | 150 | ||
161 | $response = new Response(); | 151 | $response = new Response(); |
@@ -171,8 +161,6 @@ class ShaarliControllerTest extends TestCase | |||
171 | */ | 161 | */ |
172 | public function testRedirectFromRefererWithMatchingLoopTermInQueryParam(): void | 162 | public function testRedirectFromRefererWithMatchingLoopTermInQueryParam(): void |
173 | { | 163 | { |
174 | $this->createValidContainerMockSet(); | ||
175 | |||
176 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; | 164 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; |
177 | 165 | ||
178 | $response = new Response(); | 166 | $response = new Response(); |
@@ -189,8 +177,6 @@ class ShaarliControllerTest extends TestCase | |||
189 | */ | 177 | */ |
190 | public function testRedirectFromRefererWithMatchingLoopTermInQueryValue(): void | 178 | public function testRedirectFromRefererWithMatchingLoopTermInQueryValue(): void |
191 | { | 179 | { |
192 | $this->createValidContainerMockSet(); | ||
193 | |||
194 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; | 180 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; |
195 | 181 | ||
196 | $response = new Response(); | 182 | $response = new Response(); |
@@ -207,8 +193,6 @@ class ShaarliControllerTest extends TestCase | |||
207 | */ | 193 | */ |
208 | public function testRedirectFromRefererWithLoopTermInDomain(): void | 194 | public function testRedirectFromRefererWithLoopTermInDomain(): void |
209 | { | 195 | { |
210 | $this->createValidContainerMockSet(); | ||
211 | |||
212 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; | 196 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; |
213 | 197 | ||
214 | $response = new Response(); | 198 | $response = new Response(); |
@@ -225,8 +209,6 @@ class ShaarliControllerTest extends TestCase | |||
225 | */ | 209 | */ |
226 | public function testRedirectFromRefererWithMatchingClearedParam(): void | 210 | public function testRedirectFromRefererWithMatchingClearedParam(): void |
227 | { | 211 | { |
228 | $this->createValidContainerMockSet(); | ||
229 | |||
230 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; | 212 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli.tld/subfolder/controller?query=param&other=2'; |
231 | 213 | ||
232 | $response = new Response(); | 214 | $response = new Response(); |
diff --git a/tests/front/controller/visitor/TagCloudControllerTest.php b/tests/front/controller/visitor/TagCloudControllerTest.php index e636d496..9a6a4bc0 100644 --- a/tests/front/controller/visitor/TagCloudControllerTest.php +++ b/tests/front/controller/visitor/TagCloudControllerTest.php | |||
@@ -28,8 +28,6 @@ class TagCloudControllerTest extends TestCase | |||
28 | */ | 28 | */ |
29 | public function testValidCloudControllerInvokeDefault(): void | 29 | public function testValidCloudControllerInvokeDefault(): void |
30 | { | 30 | { |
31 | $this->createValidContainerMockSet(); | ||
32 | |||
33 | $allTags = [ | 31 | $allTags = [ |
34 | 'ghi' => 1, | 32 | 'ghi' => 1, |
35 | 'abc' => 3, | 33 | 'abc' => 3, |
@@ -94,8 +92,6 @@ class TagCloudControllerTest extends TestCase | |||
94 | */ | 92 | */ |
95 | public function testValidCloudControllerInvokeWithParameters(): void | 93 | public function testValidCloudControllerInvokeWithParameters(): void |
96 | { | 94 | { |
97 | $this->createValidContainerMockSet(); | ||
98 | |||
99 | $request = $this->createMock(Request::class); | 95 | $request = $this->createMock(Request::class); |
100 | $request | 96 | $request |
101 | ->method('getQueryParam') | 97 | ->method('getQueryParam') |
@@ -161,8 +157,6 @@ class TagCloudControllerTest extends TestCase | |||
161 | */ | 157 | */ |
162 | public function testEmptyCloud(): void | 158 | public function testEmptyCloud(): void |
163 | { | 159 | { |
164 | $this->createValidContainerMockSet(); | ||
165 | |||
166 | $request = $this->createMock(Request::class); | 160 | $request = $this->createMock(Request::class); |
167 | $response = new Response(); | 161 | $response = new Response(); |
168 | 162 | ||
@@ -209,8 +203,6 @@ class TagCloudControllerTest extends TestCase | |||
209 | */ | 203 | */ |
210 | public function testValidListControllerInvokeDefault(): void | 204 | public function testValidListControllerInvokeDefault(): void |
211 | { | 205 | { |
212 | $this->createValidContainerMockSet(); | ||
213 | |||
214 | $allTags = [ | 206 | $allTags = [ |
215 | 'def' => 12, | 207 | 'def' => 12, |
216 | 'abc' => 3, | 208 | 'abc' => 3, |
@@ -271,8 +263,6 @@ class TagCloudControllerTest extends TestCase | |||
271 | */ | 263 | */ |
272 | public function testValidListControllerInvokeWithParameters(): void | 264 | public function testValidListControllerInvokeWithParameters(): void |
273 | { | 265 | { |
274 | $this->createValidContainerMockSet(); | ||
275 | |||
276 | $request = $this->createMock(Request::class); | 266 | $request = $this->createMock(Request::class); |
277 | $request | 267 | $request |
278 | ->method('getQueryParam') | 268 | ->method('getQueryParam') |
@@ -336,8 +326,6 @@ class TagCloudControllerTest extends TestCase | |||
336 | */ | 326 | */ |
337 | public function testEmptyList(): void | 327 | public function testEmptyList(): void |
338 | { | 328 | { |
339 | $this->createValidContainerMockSet(); | ||
340 | |||
341 | $request = $this->createMock(Request::class); | 329 | $request = $this->createMock(Request::class); |
342 | $response = new Response(); | 330 | $response = new Response(); |
343 | 331 | ||
diff --git a/tests/front/controller/visitor/TagControllerTest.php b/tests/front/controller/visitor/TagControllerTest.php index 9a2b1f71..1242a2e9 100644 --- a/tests/front/controller/visitor/TagControllerTest.php +++ b/tests/front/controller/visitor/TagControllerTest.php | |||
@@ -23,8 +23,6 @@ class TagControllerTest extends TestCase | |||
23 | 23 | ||
24 | public function testAddTagWithReferer(): void | 24 | public function testAddTagWithReferer(): void |
25 | { | 25 | { |
26 | $this->createValidContainerMockSet(); | ||
27 | |||
28 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/']; | 26 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/']; |
29 | 27 | ||
30 | $request = $this->createMock(Request::class); | 28 | $request = $this->createMock(Request::class); |
@@ -41,8 +39,6 @@ class TagControllerTest extends TestCase | |||
41 | 39 | ||
42 | public function testAddTagWithRefererAndExistingSearch(): void | 40 | public function testAddTagWithRefererAndExistingSearch(): void |
43 | { | 41 | { |
44 | $this->createValidContainerMockSet(); | ||
45 | |||
46 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=def']; | 42 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=def']; |
47 | 43 | ||
48 | $request = $this->createMock(Request::class); | 44 | $request = $this->createMock(Request::class); |
@@ -59,8 +55,6 @@ class TagControllerTest extends TestCase | |||
59 | 55 | ||
60 | public function testAddTagWithoutRefererAndExistingSearch(): void | 56 | public function testAddTagWithoutRefererAndExistingSearch(): void |
61 | { | 57 | { |
62 | $this->createValidContainerMockSet(); | ||
63 | |||
64 | $request = $this->createMock(Request::class); | 58 | $request = $this->createMock(Request::class); |
65 | $response = new Response(); | 59 | $response = new Response(); |
66 | 60 | ||
@@ -75,8 +69,6 @@ class TagControllerTest extends TestCase | |||
75 | 69 | ||
76 | public function testAddTagRemoveLegacyQueryParam(): void | 70 | public function testAddTagRemoveLegacyQueryParam(): void |
77 | { | 71 | { |
78 | $this->createValidContainerMockSet(); | ||
79 | |||
80 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=def&addtag=abc']; | 72 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=def&addtag=abc']; |
81 | 73 | ||
82 | $request = $this->createMock(Request::class); | 74 | $request = $this->createMock(Request::class); |
@@ -93,8 +85,6 @@ class TagControllerTest extends TestCase | |||
93 | 85 | ||
94 | public function testAddTagResetPagination(): void | 86 | public function testAddTagResetPagination(): void |
95 | { | 87 | { |
96 | $this->createValidContainerMockSet(); | ||
97 | |||
98 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=def&page=12']; | 88 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=def&page=12']; |
99 | 89 | ||
100 | $request = $this->createMock(Request::class); | 90 | $request = $this->createMock(Request::class); |
@@ -111,8 +101,6 @@ class TagControllerTest extends TestCase | |||
111 | 101 | ||
112 | public function testAddTagWithRefererAndEmptySearch(): void | 102 | public function testAddTagWithRefererAndEmptySearch(): void |
113 | { | 103 | { |
114 | $this->createValidContainerMockSet(); | ||
115 | |||
116 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=']; | 104 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=']; |
117 | 105 | ||
118 | $request = $this->createMock(Request::class); | 106 | $request = $this->createMock(Request::class); |
@@ -129,8 +117,6 @@ class TagControllerTest extends TestCase | |||
129 | 117 | ||
130 | public function testAddTagWithoutNewTagWithReferer(): void | 118 | public function testAddTagWithoutNewTagWithReferer(): void |
131 | { | 119 | { |
132 | $this->createValidContainerMockSet(); | ||
133 | |||
134 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=def']; | 120 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=def']; |
135 | 121 | ||
136 | $request = $this->createMock(Request::class); | 122 | $request = $this->createMock(Request::class); |
@@ -145,8 +131,6 @@ class TagControllerTest extends TestCase | |||
145 | 131 | ||
146 | public function testAddTagWithoutNewTagWithoutReferer(): void | 132 | public function testAddTagWithoutNewTagWithoutReferer(): void |
147 | { | 133 | { |
148 | $this->createValidContainerMockSet(); | ||
149 | |||
150 | $request = $this->createMock(Request::class); | 134 | $request = $this->createMock(Request::class); |
151 | $response = new Response(); | 135 | $response = new Response(); |
152 | 136 | ||
@@ -159,8 +143,6 @@ class TagControllerTest extends TestCase | |||
159 | 143 | ||
160 | public function testRemoveTagWithoutMatchingTag(): void | 144 | public function testRemoveTagWithoutMatchingTag(): void |
161 | { | 145 | { |
162 | $this->createValidContainerMockSet(); | ||
163 | |||
164 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=def']; | 146 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtags=def']; |
165 | 147 | ||
166 | $request = $this->createMock(Request::class); | 148 | $request = $this->createMock(Request::class); |
@@ -177,8 +159,6 @@ class TagControllerTest extends TestCase | |||
177 | 159 | ||
178 | public function testRemoveTagWithoutTagsearch(): void | 160 | public function testRemoveTagWithoutTagsearch(): void |
179 | { | 161 | { |
180 | $this->createValidContainerMockSet(); | ||
181 | |||
182 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/']; | 162 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/']; |
183 | 163 | ||
184 | $request = $this->createMock(Request::class); | 164 | $request = $this->createMock(Request::class); |
@@ -195,8 +175,6 @@ class TagControllerTest extends TestCase | |||
195 | 175 | ||
196 | public function testRemoveTagWithoutReferer(): void | 176 | public function testRemoveTagWithoutReferer(): void |
197 | { | 177 | { |
198 | $this->createValidContainerMockSet(); | ||
199 | |||
200 | $request = $this->createMock(Request::class); | 178 | $request = $this->createMock(Request::class); |
201 | $response = new Response(); | 179 | $response = new Response(); |
202 | 180 | ||
@@ -211,8 +189,6 @@ class TagControllerTest extends TestCase | |||
211 | 189 | ||
212 | public function testRemoveTagWithoutTag(): void | 190 | public function testRemoveTagWithoutTag(): void |
213 | { | 191 | { |
214 | $this->createValidContainerMockSet(); | ||
215 | |||
216 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtag=abc']; | 192 | $this->container->environment = ['HTTP_REFERER' => 'http://shaarli/controller/?searchtag=abc']; |
217 | 193 | ||
218 | $request = $this->createMock(Request::class); | 194 | $request = $this->createMock(Request::class); |
@@ -227,8 +203,6 @@ class TagControllerTest extends TestCase | |||
227 | 203 | ||
228 | public function testRemoveTagWithoutTagWithoutReferer(): void | 204 | public function testRemoveTagWithoutTagWithoutReferer(): void |
229 | { | 205 | { |
230 | $this->createValidContainerMockSet(); | ||
231 | |||
232 | $request = $this->createMock(Request::class); | 206 | $request = $this->createMock(Request::class); |
233 | $response = new Response(); | 207 | $response = new Response(); |
234 | 208 | ||