@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace Mezon\Router\Tests\Standart; |
4 | 4 | |
5 | 5 | use Mezon\Router\RouterInterface; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace Mezon\Router\Tests; |
4 | 4 | |
5 | 5 | use Mezon\Router\Router; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace Mezon\Router\Tests\Base; |
4 | 4 | |
5 | 5 | use Mezon\Router\Types\DateRouterType; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $router->addType('date', DateRouterType::class); |
194 | 194 | |
195 | 195 | foreach ($pattern as $r) { |
196 | - $router->addRoute($r, function () { |
|
196 | + $router->addRoute($r, function() { |
|
197 | 197 | // do nothing |
198 | 198 | }, $method); |
199 | 199 | } |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | { |
212 | 212 | // setup |
213 | 213 | $router = $this->getRouter(); |
214 | - for ($i = 0; $i < 15; $i ++) { |
|
215 | - $router->addRoute('/multiple/' . $i . '/[i:id]', function () { |
|
214 | + for ($i = 0; $i < 15; $i++) { |
|
215 | + $router->addRoute('/multiple/' . $i . '/[i:id]', function() { |
|
216 | 216 | return 'done!'; |
217 | 217 | }); |
218 | 218 | } |
@@ -233,22 +233,22 @@ discard block |
||
233 | 233 | { |
234 | 234 | // setup |
235 | 235 | $router = $this->getRouter(); |
236 | - $router->addRoute('/user/[s:login]/custom-field/[s:name]', function () { |
|
236 | + $router->addRoute('/user/[s:login]/custom-field/[s:name]', function() { |
|
237 | 237 | return 'get-custom-field'; |
238 | 238 | }); |
239 | - $router->addRoute('/user/[s:login]/custom-field/[s:name]/add', function () { |
|
239 | + $router->addRoute('/user/[s:login]/custom-field/[s:name]/add', function() { |
|
240 | 240 | return 'add-custom-field'; |
241 | 241 | }); |
242 | - $router->addRoute('/user/[s:login]/custom-field/[s:name]/delete', function () { |
|
242 | + $router->addRoute('/user/[s:login]/custom-field/[s:name]/delete', function() { |
|
243 | 243 | return 'delete-custom-field'; |
244 | 244 | }); |
245 | - $router->addRoute('/restore-password/[s:token]', function () { |
|
245 | + $router->addRoute('/restore-password/[s:token]', function() { |
|
246 | 246 | return 'restore-password'; |
247 | 247 | }); |
248 | - $router->addRoute('/reset-password/[s:token]', function () { |
|
248 | + $router->addRoute('/reset-password/[s:token]', function() { |
|
249 | 249 | return 'reset-password'; |
250 | 250 | }); |
251 | - $router->addRoute('/user/[s:login]/delete', function () { |
|
251 | + $router->addRoute('/user/[s:login]/delete', function() { |
|
252 | 252 | return 'user-delete'; |
253 | 253 | }); |
254 | 254 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace Mezon\Router\Tests\Base; |
4 | 4 | |
5 | 5 | use PHPUnit\Framework\TestCase; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace Mezon\Router\Tests\Base; |
4 | 4 | |
5 | 5 | use PHPUnit\Framework\TestCase; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | // setup |
31 | 31 | $router = $this->getRouter(); |
32 | - $router->addRoute('/catalog/[i:foo]/', function (): void { |
|
32 | + $router->addRoute('/catalog/[i:foo]/', function(): void { |
|
33 | 33 | // do nothing |
34 | 34 | }); |
35 | 35 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * route |
53 | 53 | * @param string[] $parameters |
54 | 54 | */ |
55 | - function (string $route, array $parameters): string { |
|
55 | + function(string $route, array $parameters): string { |
|
56 | 56 | return $parameters['cat_id']; |
57 | 57 | }); |
58 | 58 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * route |
75 | 75 | * @param string[] $parameters |
76 | 76 | */ |
77 | - function (string $route, array $parameters): string { |
|
77 | + function(string $route, array $parameters): string { |
|
78 | 78 | return $parameters['cat_id'] . $parameters['item_id']; |
79 | 79 | }); |
80 | 80 | |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | { |
92 | 92 | // setup |
93 | 93 | $router = $this->getRouter(); |
94 | - for ($i = 0; $i < 15; $i ++) { |
|
95 | - $router->addRoute('/multiple/' . $i . '/[i:id]', function () { |
|
94 | + for ($i = 0; $i < 15; $i++) { |
|
95 | + $router->addRoute('/multiple/' . $i . '/[i:id]', function() { |
|
96 | 96 | return 'done!'; |
97 | 97 | }); |
98 | 98 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace Mezon\Router\Tests\Base; |
4 | 4 | |
5 | 5 | /** |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | // setup |
39 | 39 | RouterUnitTestUtils::setRequestMethod('GET'); |
40 | 40 | $router = $this->getRouter(); |
41 | - for ($i = 1; $i <= $amount; $i ++) { |
|
42 | - $router->addRoute('/param/[i:id]/' . $i, function () use ($i): int { |
|
41 | + for ($i = 1; $i <= $amount; $i++) { |
|
42 | + $router->addRoute('/param/[i:id]/' . $i, function() use ($i): int { |
|
43 | 43 | return $i; |
44 | 44 | }); |
45 | 45 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace Mezon\Router\Tests\Base; |
4 | 4 | |
5 | 5 | /** |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | // assertions |
23 | 23 | $this->expectException(\Exception::class); |
24 | - $this->expectExceptionCode(- 1); |
|
24 | + $this->expectExceptionCode(-1); |
|
25 | 25 | $this->expectErrorMessage('The processor was not found for the route unexisting in GET : r1, ; POST : r1, ; PUT : <none>; DELETE : <none>; OPTION : <none>; PATCH : <none>'); |
26 | 26 | |
27 | 27 | // test body |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace Mezon\Router\Tests\Base; |
4 | 4 | |
5 | 5 | use PHPUnit\Framework\TestCase; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | // setup |
31 | 31 | $router = $this->getRouter(); |
32 | - $router->addRoute('/catalog/[i:foo]/', function () { |
|
32 | + $router->addRoute('/catalog/[i:foo]/', function() { |
|
33 | 33 | // do nothing |
34 | 34 | }); |
35 | 35 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | // setup |
50 | 50 | $_SERVER['REQUEST_METHOD'] = 'HEAD'; |
51 | 51 | $router = $this->getRouter(); |
52 | - $router->addRoute('/catalog/[i:foo]/', function () { |
|
52 | + $router->addRoute('/catalog/[i:foo]/', function() { |
|
53 | 53 | // do nothing |
54 | 54 | }); |
55 | 55 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | // setup |
69 | 69 | $router = $this->getRouter(); |
70 | - $router->addRoute('/catalog/[il:cat_id]/', function () { |
|
70 | + $router->addRoute('/catalog/[il:cat_id]/', function() { |
|
71 | 71 | return 1; |
72 | 72 | }); |
73 | 73 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $exception = ''; |
90 | 90 | $router = $this->getRouter(); |
91 | - $router->addRoute('/catalog/[i:cat_id]', function () { |
|
91 | + $router->addRoute('/catalog/[i:cat_id]', function() { |
|
92 | 92 | return 1; |
93 | 93 | }); |
94 | 94 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $exception = ''; |
114 | 114 | $router = $this->getRouter(); |
115 | - $router->addRoute('/catalog/[i:cat_id]', function () { |
|
115 | + $router->addRoute('/catalog/[i:cat_id]', function() { |
|
116 | 116 | return 1; |
117 | 117 | }); |
118 | 118 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | $exception = ''; |
138 | 138 | $router = $this->getRouter(); |
139 | - $router->addRoute('/catalog/[i:item_id]', function () { |
|
139 | + $router->addRoute('/catalog/[i:item_id]', function() { |
|
140 | 140 | return 1; |
141 | 141 | }); |
142 | 142 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | { |
180 | 180 | // setup |
181 | 181 | $router = $this->getRouter(); |
182 | - $router->addRoute($route, function () { |
|
182 | + $router->addRoute($route, function() { |
|
183 | 183 | // do nothing |
184 | 184 | }); |
185 | 185 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | public function testInvalidType(): void |
197 | 197 | { |
198 | 198 | $router = $this->getRouter(); |
199 | - $router->addRoute('/catalog/[unexisting-type:i]/item/', function () { |
|
199 | + $router->addRoute('/catalog/[unexisting-type:i]/item/', function() { |
|
200 | 200 | return 1; |
201 | 201 | }); |
202 | 202 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | public function testValidInvalidTypes(): void |
215 | 215 | { |
216 | 216 | $router = $this->getRouter(); |
217 | - $router->addRoute('/catalog/[i:cat_id]/item/[unexisting-type-trace:item_id]/', function () { |
|
217 | + $router->addRoute('/catalog/[i:cat_id]/item/[unexisting-type-trace:item_id]/', function() { |
|
218 | 218 | return 1; |
219 | 219 | }); |
220 | 220 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace Mezon\Router\Tests\Base; |
4 | 4 | |
5 | 5 | use Mezon\Router\Tests\Utils; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $router = $this->getRouter(); |
91 | 91 | $router->addRoute('/trash/', [ |
92 | 92 | $this, |
93 | - function (): void {} |
|
93 | + function(): void {} |
|
94 | 94 | ]); |
95 | 95 | |
96 | 96 | // assertions |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | public function testArrayRoutes(): void |
107 | 107 | { |
108 | 108 | $router = $this->getRouter(); |
109 | - $router->addRoute('/part1/part2/', function (string $route): string { |
|
109 | + $router->addRoute('/part1/part2/', function(string $route): string { |
|
110 | 110 | return $route; |
111 | 111 | }, 'GET'); |
112 | 112 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $this->setRequestUri('/catalog/item/'); |
128 | 128 | |
129 | 129 | $router = $this->getRouter(); |
130 | - $router->addRoute('/catalog/item/', function (string $route): string { |
|
130 | + $router->addRoute('/catalog/item/', function(string $route): string { |
|
131 | 131 | return $route; |
132 | 132 | }, 'GET'); |
133 | 133 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $this->setRequestUri('/'); |
148 | 148 | |
149 | 149 | $router = $this->getRouter(); |
150 | - $router->addRoute('/index/', function (string $route): string { |
|
150 | + $router->addRoute('/index/', function(string $route): string { |
|
151 | 151 | return $route; |
152 | 152 | }, 'GET'); |
153 | 153 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $this->setRequestUri('/'); |
169 | 169 | |
170 | 170 | $router = $this->getRouter(); |
171 | - $router->addRoute('/index/', function (string $route): string { |
|
171 | + $router->addRoute('/index/', function(string $route): string { |
|
172 | 172 | return $route; |
173 | 173 | }, [ |
174 | 174 | 'GET', |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | { |
293 | 293 | // setup |
294 | 294 | $router = $this->getRouter(); |
295 | - $router->addRoute('/route-to-clear/', function () use ($method) { |
|
295 | + $router->addRoute('/route-to-clear/', function() use ($method) { |
|
296 | 296 | return $method; |
297 | 297 | }, $method); |
298 | 298 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $_SERVER['REQUEST_METHOD'] = $method; |
316 | 316 | |
317 | 317 | $router = $this->getRouter(); |
318 | - $router->addRoute('/catalog/', function (string $route): string { |
|
318 | + $router->addRoute('/catalog/', function(string $route): string { |
|
319 | 319 | return $route; |
320 | 320 | }, $method); |
321 | 321 | |
@@ -332,10 +332,10 @@ discard block |
||
332 | 332 | { |
333 | 333 | // setup |
334 | 334 | $router = $this->getRouter(); |
335 | - $router->addRoute('/searching-static-route/', function (string $route) { |
|
335 | + $router->addRoute('/searching-static-route/', function(string $route) { |
|
336 | 336 | return $route; |
337 | 337 | }); |
338 | - $router->addRoute('/searching-param-route/[i:id]/', function (string $route) { |
|
338 | + $router->addRoute('/searching-param-route/[i:id]/', function(string $route) { |
|
339 | 339 | return $route; |
340 | 340 | }); |
341 | 341 |