@@ -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.
@@ -241,20 +239,16 @@ public function testGenerateWithOverriddenParameterLocaleFromRequestContext()
241
239
);
242
240
}
243
241
244
- /**
245
- * @expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException
246
- */
247
242
public function testGenerateWithoutRoutes ()
248
243
{
244
+ $ this ->expectException ('Symfony\Component\Routing\Exception\RouteNotFoundException ' );
249
245
$ routes = $ this ->getRoutes ('foo ' , new Route ('/testing/{foo} ' ));
250
246
$ this ->getGenerator ($ routes )->generate ('test ' , [], UrlGeneratorInterface::ABSOLUTE_URL );
251
247
}
252
248
253
- /**
254
- * @expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException
255
- */
256
249
public function testGenerateWithInvalidLocale ()
257
250
{
251
+ $ this ->expectException ('Symfony\Component\Routing\Exception\RouteNotFoundException ' );
258
252
$ routes = new RouteCollection ();
259
253
260
254
$ route = new Route ('' );
@@ -273,29 +267,23 @@ public function testGenerateWithInvalidLocale()
273
267
$ generator ->generate ($ name );
274
268
}
275
269
276
- /**
277
- * @expectedException \Symfony\Component\Routing\Exception\MissingMandatoryParametersException
278
- */
279
270
public function testGenerateForRouteWithoutMandatoryParameter ()
280
271
{
272
+ $ this ->expectException ('Symfony\Component\Routing\Exception\MissingMandatoryParametersException ' );
281
273
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing/{foo} ' ));
282
274
$ this ->getGenerator ($ routes )->generate ('test ' , [], UrlGeneratorInterface::ABSOLUTE_URL );
283
275
}
284
276
285
- /**
286
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
287
- */
288
277
public function testGenerateForRouteWithInvalidOptionalParameter ()
289
278
{
279
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
290
280
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing/{foo} ' , ['foo ' => '1 ' ], ['foo ' => 'd+ ' ]));
291
281
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'bar ' ], UrlGeneratorInterface::ABSOLUTE_URL );
292
282
}
293
283
294
- /**
295
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
296
- */
297
284
public function testGenerateForRouteWithInvalidParameter ()
298
285
{
286
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
299
287
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing/{foo} ' , [], ['foo ' => '1|2 ' ]));
300
288
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => '0 ' ], UrlGeneratorInterface::ABSOLUTE_URL );
301
289
}
@@ -327,29 +315,23 @@ public function testGenerateForRouteWithInvalidParameterButDisabledRequirementsC
327
315
$ this ->assertSame ('/app.php/testing/bar ' , $ generator ->generate ('test ' , ['foo ' => 'bar ' ]));
328
316
}
329
317
330
- /**
331
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
332
- */
333
318
public function testGenerateForRouteWithInvalidMandatoryParameter ()
334
319
{
320
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
335
321
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing/{foo} ' , [], ['foo ' => 'd+ ' ]));
336
322
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'bar ' ], UrlGeneratorInterface::ABSOLUTE_URL );
337
323
}
338
324
339
- /**
340
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
341
- */
342
325
public function testGenerateForRouteWithInvalidUtf8Parameter ()
343
326
{
327
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
344
328
$ routes = $ this ->getRoutes ('test ' , new Route ('/testing/{foo} ' , [], ['foo ' => '\pL+ ' ], ['utf8 ' => true ]));
345
329
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'abc123 ' ], UrlGeneratorInterface::ABSOLUTE_URL );
346
330
}
347
331
348
- /**
349
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
350
- */
351
332
public function testRequiredParamAndEmptyPassed ()
352
333
{
334
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
353
335
$ routes = $ this ->getRoutes ('test ' , new Route ('/{slug} ' , [], ['slug ' => '.+ ' ]));
354
336
$ this ->getGenerator ($ routes )->generate ('test ' , ['slug ' => '' ]);
355
337
}
@@ -509,31 +491,25 @@ public function testImportantVariable()
509
491
$ this ->assertSame ('/app.php/index.mobile.html ' , $ generator ->generate ('test ' , ['page ' => 'index ' ]));
510
492
}
511
493
512
- /**
513
- * @expectedException \Symfony\Component\Routing\Exception\MissingMandatoryParametersException
514
- */
515
494
public function testImportantVariableWithNoDefault ()
516
495
{
496
+ $ this ->expectException ('Symfony\Component\Routing\Exception\MissingMandatoryParametersException ' );
517
497
$ routes = $ this ->getRoutes ('test ' , new Route ('/{page}.{!_format} ' ));
518
498
$ generator = $ this ->getGenerator ($ routes );
519
499
520
500
$ generator ->generate ('test ' , ['page ' => 'index ' ]);
521
501
}
522
502
523
- /**
524
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
525
- */
526
503
public function testDefaultRequirementOfVariableDisallowsSlash ()
527
504
{
505
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
528
506
$ routes = $ this ->getRoutes ('test ' , new Route ('/{page}.{_format} ' ));
529
507
$ this ->getGenerator ($ routes )->generate ('test ' , ['page ' => 'index ' , '_format ' => 'sl/ash ' ]);
530
508
}
531
509
532
- /**
533
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
534
- */
535
510
public function testDefaultRequirementOfVariableDisallowsNextSeparator ()
536
511
{
512
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
537
513
$ routes = $ this ->getRoutes ('test ' , new Route ('/{page}.{_format} ' ));
538
514
$ this ->getGenerator ($ routes )->generate ('test ' , ['page ' => 'do.t ' , '_format ' => 'html ' ]);
539
515
}
@@ -559,29 +535,23 @@ public function testWithHostSameAsContextAndAbsolute()
559
535
$ 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 ));
560
536
}
561
537
562
- /**
563
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
564
- */
565
538
public function testUrlWithInvalidParameterInHost ()
566
539
{
540
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
567
541
$ routes = $ this ->getRoutes ('test ' , new Route ('/ ' , [], ['foo ' => 'bar ' ], [], '{foo}.example.com ' ));
568
542
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'baz ' ], UrlGeneratorInterface::ABSOLUTE_PATH );
569
543
}
570
544
571
- /**
572
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
573
- */
574
545
public function testUrlWithInvalidParameterInHostWhenParamHasADefaultValue ()
575
546
{
547
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
576
548
$ routes = $ this ->getRoutes ('test ' , new Route ('/ ' , ['foo ' => 'bar ' ], ['foo ' => 'bar ' ], [], '{foo}.example.com ' ));
577
549
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'baz ' ], UrlGeneratorInterface::ABSOLUTE_PATH );
578
550
}
579
551
580
- /**
581
- * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
582
- */
583
552
public function testUrlWithInvalidParameterEqualsDefaultValueInHost ()
584
553
{
554
+ $ this ->expectException ('Symfony\Component\Routing\Exception\InvalidParameterException ' );
585
555
$ routes = $ this ->getRoutes ('test ' , new Route ('/ ' , ['foo ' => 'baz ' ], ['foo ' => 'bar ' ], [], '{foo}.example.com ' ));
586
556
$ this ->getGenerator ($ routes )->generate ('test ' , ['foo ' => 'baz ' ], UrlGeneratorInterface::ABSOLUTE_PATH );
587
557
}
0 commit comments