File tree Expand file tree Collapse file tree 6 files changed +812
-0
lines changed
Fixtures/templates/anonymous Expand file tree Collapse file tree 6 files changed +812
-0
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -178,6 +178,29 @@ public function testLoadingAnonymousComponentFromBundle()
178178 $ this ->assertNull ($ metadata ->get ('class ' ));
179179 }
180180
181+ public function testLoadingNestedAnonymousComponent ()
182+ {
183+ self ::bootKernel (['environment ' => 'anonymous_directory ' ]);
184+
185+ $ metadata = $ this ->factory ()->metadataFor ('Menu ' );
186+
187+ $ this ->assertSame ('anonymous/Menu/index.html.twig ' , $ metadata ->getTemplate ());
188+ $ this ->assertSame ('Menu ' , $ metadata ->getName ());
189+ $ this ->assertNull ($ metadata ->get ('class ' ));
190+
191+ $ metadata = $ this ->factory ()->metadataFor ('Menu:Item ' );
192+
193+ $ this ->assertSame ('anonymous/Menu/Item.html.twig ' , $ metadata ->getTemplate ());
194+ $ this ->assertSame ('Menu:Item ' , $ metadata ->getName ());
195+ $ this ->assertNull ($ metadata ->get ('class ' ));
196+
197+ // Ensure anonymous/Bar.html.twig takes precedence over anonymous/Bar/index.html.twig
198+ $ metadata = $ this ->factory ()->metadataFor ('Bar ' );
199+ $ this ->assertSame ('anonymous/Bar.html.twig ' , $ metadata ->getTemplate ());
200+ $ this ->assertSame ('Bar ' , $ metadata ->getName ());
201+ $ this ->assertNull ($ metadata ->get ('class ' ));
202+ }
203+
181204 public function testAutoNamingInSubDirectory ()
182205 {
183206 $ metadata = $ this ->factory ()->metadataFor ('SubDirectory:ComponentInSubDirectory ' );
You can’t perform that action at this time.
0 commit comments