File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
src/Symfony/Bundle/FrameworkBundle/Tests/Routing Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1717
1818class RoutingTest extends \PHPUnit_Framework_TestCase
1919{
20+ public function testGenerateWithServiceParam ()
21+ {
22+ $ routes = new RouteCollection ();
23+
24+ $ routes ->add ('foo ' , new Route (
25+ ' /{_locale} ' ,
26+ array (
27+ '_locale ' => '%locale% '
28+ ),
29+ array (
30+ '_locale ' => 'en|es ' ,
31+ )
32+ ));
33+
34+ $ sc = $ this ->getServiceContainer ($ routes );
35+
36+ $ sc ->expects ($ this ->at (1 ))->method ('hasParameter ' )->will ($ this ->returnValue (true ));
37+ $ sc ->expects ($ this ->at (2 ))->method ('getParameter ' )->will ($ this ->returnValue ('es ' ));
38+
39+ $ router = new Router ($ sc , 'foo ' );
40+ $ route = $ router ->getRouteCollection ()->get ('foo ' );
41+
42+ $ this ->assertSame ('/en ' , $ router ->generate ('foo ' , array ('_locale ' => 'en ' )));
43+ $ this ->assertSame ('/ ' , $ router ->generate ('foo ' , array ('_locale ' => 'es ' )));
44+ }
45+
2046 public function testDefaultsPlaceholders ()
2147 {
2248 $ routes = new RouteCollection ();
You can’t perform that action at this time.
0 commit comments