File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
src/Symfony/Component/Routing Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,9 @@ public function build()
311
311
$ subCollection ->addPrefix ($ this ->prefix );
312
312
313
313
$ routeCollection ->addCollection ($ subCollection );
314
+ foreach ($ route ->resources as $ resource ) {
315
+ $ routeCollection ->addResource ($ resource );
316
+ }
314
317
}
315
318
316
319
foreach ($ this ->resources as $ resource ) {
Original file line number Diff line number Diff line change 12
12
namespace Symfony \Component \Routing \Tests ;
13
13
14
14
use PHPUnit \Framework \TestCase ;
15
+ use Symfony \Component \Config \FileLocator ;
15
16
use Symfony \Component \Config \Resource \FileResource ;
17
+ use Symfony \Component \Routing \Loader \YamlFileLoader ;
16
18
use Symfony \Component \Routing \Route ;
17
19
use Symfony \Component \Routing \RouteCollection ;
18
20
use Symfony \Component \Routing \RouteCollectionBuilder ;
@@ -59,7 +61,18 @@ public function testImport()
59
61
$ this ->assertCount (1 , $ addedCollection ->getResources ());
60
62
61
63
// make sure the routes were imported into the top-level builder
64
+ $ routeCollection = $ routes ->build ();
62
65
$ this ->assertCount (1 , $ routes ->build ());
66
+ $ this ->assertCount (1 , $ routeCollection ->getResources ());
67
+ }
68
+
69
+ public function testImportAddResources ()
70
+ {
71
+ $ routeCollectionBuilder = new RouteCollectionBuilder (new YamlFileLoader (new FileLocator (array (__DIR__ .'/Fixtures/ ' ))));
72
+ $ routeCollectionBuilder ->import ('file_resource.yml ' );
73
+
74
+ $ routeCollection = $ routeCollectionBuilder ->build ();
75
+ $ this ->assertCount (1 , $ routeCollection ->getResources ());
63
76
}
64
77
65
78
/**
You can’t perform that action at this time.
0 commit comments