File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
tests/Symfony/Tests/Component/Routing Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ use Symfony \Component \Routing \RouteCollection ;
3+ use Symfony \Component \Routing \Route ;
4+
5+ $ collection = new RouteCollection ();
6+ $ collection ->add ('blog_show ' , new Route ('/blog/{slug} ' , array (
7+ '_controller ' => 'MyBlogBundle:Blog:show ' ,
8+ )));
9+
10+ return $ collection ;
Original file line number Diff line number Diff line change 1212namespace Symfony \Tests \Component \Routing \Loader ;
1313
1414use Symfony \Component \Config \Loader \LoaderResolver ;
15+ use Symfony \Component \Config \FileLocator ;
1516use Symfony \Component \Routing \Loader \PhpFileLoader ;
1617use Symfony \Component \Routing \Route ;
1718use Symfony \Component \Routing \RouteCollection ;
@@ -31,4 +32,15 @@ public function testSupports()
3132 $ this ->assertTrue ($ loader ->supports ('foo.php ' , 'php ' ), '->supports() checks the resource type if specified ' );
3233 $ this ->assertFalse ($ loader ->supports ('foo.php ' , 'foo ' ), '->supports() checks the resource type if specified ' );
3334 }
35+
36+ public function testLoadWithRoute ()
37+ {
38+ $ loader = new PhpFileLoader (new FileLocator (array (__DIR__ .'/../Fixtures ' )));
39+ $ routeCollection = $ loader ->load ('validpattern.php ' );
40+ $ routes = $ routeCollection ->all ();
41+
42+ $ this ->assertEquals (1 , count ($ routes ), 'One route is loaded ' );
43+ $ this ->assertContainsOnly ('Symfony\Component\Routing\Route ' , $ routes );
44+ }
3445}
46+
You can’t perform that action at this time.
0 commit comments