@@ -79,11 +79,9 @@ public function testRelativeUrlWithNullParameter()
79
79
$ this ->assertEquals ('/app.php/testing ' , $ url );
80
80
}
81
81
82
- /**
83
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
84
- */
85
82
public function testRelativeUrlWithNullParameterButNotOptional ()
86
83
{
84
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
87
85
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing/{foo}/bar ' , ['foo ' => null ]));
88
86
// This must raise an exception because the default requirement for "foo" is "[^/]+" which is not met with these params.
89
87
// Generating path "/testing//bar" would be wrong as matching this route would fail.
@@ -165,38 +163,30 @@ public function testGlobalParameterHasHigherPriorityThanDefault()
165
163
$ this ->assertSame ('/app.php/de ' , $ url );
166
164
}
167
165
168
- /**
169
- * @expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException
170
- */
171
166
public function testGenerateWithoutRoutes ()
172
167
{
168
+ $ this ->expectException ('Symfony\Component\Routing\Exception\RouteNotFoundException ' );
173
169
$ routes = $ this ->getRoutes ('foo ' , new Route ('/testing/{foo} ' ));
174
170
$ this ->getGenerator ($ routes )->generate ('test ' , [], UrlGeneratorInterface::ABSOLUTE_URL );
175
171
}
176
172
177
- /**
178
- * @expectedException \Symfony\Component\Routing\Exception\MissingMandatoryParametersException
179
- */
180
173
public function testGenerateForRouteWithoutMandatoryParameter ()
181
174
{
175
+ $ this ->expectException ('Symfony\Component\Routing\Exception\MissingMandatoryParametersException ' );
182
176
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing/{foo} ' ));
183
177
$ this ->getGenerator ($ routes )->generate ('test ' , [], UrlGeneratorInterface::ABSOLUTE_URL );
184
178
}
185
179
186
- /**
187
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
188
- */
189
180
public function testGenerateForRouteWithInvalidOptionalParameter ()
190
181
{
182
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
191
183
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing/{foo} ' , ['foo ' => '1 ' ], ['foo ' => 'd+ ' ]));
192
184
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'bar ' ], UrlGeneratorInterface::ABSOLUTE_URL );
193
185
}
194
186
195
- /**
196
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
197
- */
198
187
public function testGenerateForRouteWithInvalidParameter ()
199
188
{
189
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
200
190
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing/{foo} ' , [], ['foo ' => '1|2 ' ]));
201
191
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => '0 ' ], UrlGeneratorInterface::ABSOLUTE_URL );
202
192
}
@@ -228,29 +218,23 @@ public function testGenerateForRouteWithInvalidParameterButDisabledRequirementsC
228
218
$ this ->assertSame ('/app.php/testing/bar ' , $ generator ->generate ('test ' , ['foo ' => 'bar ' ]));
229
219
}
230
220
231
- /**
232
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
233
- */
234
221
public function testGenerateForRouteWithInvalidMandatoryParameter ()
235
222
{
223
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
236
224
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing/{foo} ' , [], ['foo ' => 'd+ ' ]));
237
225
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'bar ' ], UrlGeneratorInterface::ABSOLUTE_URL );
238
226
}
239
227
240
- /**
241
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
242
- */
243
228
public function testGenerateForRouteWithInvalidUtf8Parameter ()
244
229
{
230
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
245
231
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing/{foo} ' , [], ['foo ' => '\pL+ ' ], ['utf8 ' => true ]));
246
232
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'abc123 ' ], UrlGeneratorInterface::ABSOLUTE_URL );
247
233
}
248
234
249
- /**
250
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
251
- */
252
235
public function testRequiredParamAndEmptyPassed ()
253
236
{
237
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
254
238
$ routes = $ this ->getRoutes ('test ' , new Route ('/{slug} ' , [], ['slug ' => '.+ ' ]));
255
239
$ this ->getGenerator ($ routes )->generate ('test ' , ['slug ' => '' ]);
256
240
}
@@ -400,20 +384,16 @@ public function testDefaultRequirementOfVariable()
400
384
$ this ->assertSame ('/app.php/index.mobile.html ' , $ generator ->generate ('test ' , ['page ' => 'index ' , '_format ' => 'mobile.html ' ]));
401
385
}
402
386
403
- /**
404
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
405
- */
406
387
public function testDefaultRequirementOfVariableDisallowsSlash ()
407
388
{
389
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
408
390
$ routes = $ this ->getRoutes ('test ' , new Route ('/{page}.{_format} ' ));
409
391
$ this ->getGenerator ($ routes )->generate ('test ' , ['page ' => 'index ' , '_format ' => 'sl/ash ' ]);
410
392
}
411
393
412
- /**
413
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
414
- */
415
394
public function testDefaultRequirementOfVariableDisallowsNextSeparator ()
416
395
{
396
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
417
397
$ routes = $ this ->getRoutes ('test ' , new Route ('/{page}.{_format} ' ));
418
398
$ this ->getGenerator ($ routes )->generate ('test ' , ['page ' => 'do.t ' , '_format ' => 'html ' ]);
419
399
}
@@ -439,29 +419,23 @@ public function testWithHostSameAsContextAndAbsolute()
439
419
$ this ->assertEquals ('http://fr.example.com/app.php/Fabien ' , $ this ->getGenerator ($ routes , ['host ' => 'fr.example.com ' ])->generate ('test ' , ['name ' => 'Fabien ' , 'locale ' => 'fr ' ], UrlGeneratorInterface::ABSOLUTE_URL ));
440
420
}
441
421
442
- /**
443
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
444
- */
445
422
public function testUrlWithInvalidParameterInHost ()
446
423
{
424
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
447
425
$ routes = $ this ->getRoutes ('test ' , new Route ('/ ' , [], ['foo ' => 'bar ' ], [], '{foo}.example.com ' ));
448
426
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'baz ' ], UrlGeneratorInterface::ABSOLUTE_PATH );
449
427
}
450
428
451
- /**
452
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
453
- */
454
429
public function testUrlWithInvalidParameterInHostWhenParamHasADefaultValue ()
455
430
{
431
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
456
432
$ routes = $ this ->getRoutes ('test ' , new Route ('/ ' , ['foo ' => 'bar ' ], ['foo ' => 'bar ' ], [], '{foo}.example.com ' ));
457
433
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'baz ' ], UrlGeneratorInterface::ABSOLUTE_PATH );
458
434
}
459
435
460
- /**
461
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
462
- */
463
436
public function testUrlWithInvalidParameterEqualsDefaultValueInHost ()
464
437
{
438
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
465
439
$ routes = $ this ->getRoutes ('test ' , new Route ('/ ' , ['foo ' => 'baz ' ], ['foo ' => 'bar ' ], [], '{foo}.example.com ' ));
466
440
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'baz ' ], UrlGeneratorInterface::ABSOLUTE_PATH );
467
441
}
0 commit comments