Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ThemeBundle] Add support for Twig namespaced paths and "templates/" top-level directory #9804

Merged
merged 2 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Prepare tests for ThemeBundle
  • Loading branch information
pamil committed Oct 9, 2018
commit 54c7e8bda1bb6338aabdd377e6faa11c56f819bf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedBothThemesTemplate.txt.twig|sylius/first-test-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedVanillaOverriddenThemeTemplate.txt.twig|sylius/first-test-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Templating/twigNamespacedBothThemesTemplate.txt.twig|sylius/first-test-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedBothThemesTemplate.txt.twig|sylius/second-test-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedLastThemeTemplate.txt.twig|sylius/second-test-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Templating/twigNamespacedBothThemesTemplate.txt.twig|sylius/second-test-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Templating/twigNamespacedLastThemeTemplate.txt.twig|sylius/second-test-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedBothThemesTemplate.txt.twig|sylius/third-test-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedLastThemeTemplate.txt.twig|sylius/third-test-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Templating/twigNamespacedBothThemesTemplate.txt.twig|sylius/third-test-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Templating/twigNamespacedLastThemeTemplate.txt.twig|sylius/third-test-theme
14 changes: 11 additions & 3 deletions src/Sylius/Bundle/ThemeBundle/Tests/Functional/TemplatingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public function getBundleTemplatesUsingNamespacedPaths()
['@Test/Templating/vanillaOverriddenThemeTemplate.txt.twig', 'TestBundle:Templating:vanillaOverriddenThemeTemplate.txt.twig|sylius/first-test-theme'],
['@Test/Templating/bothThemesTemplate.txt.twig', 'TestBundle:Templating:bothThemesTemplate.txt.twig|sylius/first-test-theme'],
['@Test/Templating/lastThemeTemplate.txt.twig', 'TestBundle:Templating:lastThemeTemplate.txt.twig|sylius/second-test-theme'],
['@Test/Templating/twigNamespacedVanillaTemplate.txt.twig', '@Test/Templating/twigNamespacedVanillaTemplate.txt.twig'],
['@Test/Templating/twigNamespacedVanillaOverriddenTemplate.txt.twig', '@Test/Templating/twigNamespacedVanillaOverriddenTemplate.txt.twig (templates overridden)'],
['@Test/Templating/twigNamespacedVanillaOverriddenThemeTemplate.txt.twig', '@Test/Templating/twigNamespacedVanillaOverriddenThemeTemplate.txt.twig|sylius/first-test-theme'],
['@Test/Templating/twigNamespacedBothThemesTemplate.txt.twig', '@Test/Templating/twigNamespacedBothThemesTemplate.txt.twig|sylius/first-test-theme'],
['@Test/Templating/twigNamespacedLastThemeTemplate.txt.twig', '@Test/Templating/twigNamespacedLastThemeTemplate.txt.twig|sylius/second-test-theme'],
];
}

Expand Down Expand Up @@ -123,9 +128,12 @@ public function it_renders_application_templates_using_namespaced_paths($templat
public function getAppTemplatesUsingNamespacedPaths()
{
return [
['/Templating/vanillaTemplate.txt.twig', ':Templating:vanillaTemplate.txt.twig'],
['/Templating/bothThemesTemplate.txt.twig', ':Templating:bothThemesTemplate.txt.twig|sylius/first-test-theme'],
['/Templating/lastThemeTemplate.txt.twig', ':Templating:lastThemeTemplate.txt.twig|sylius/second-test-theme'],
['Templating/vanillaTemplate.txt.twig', ':Templating:vanillaTemplate.txt.twig'],
['Templating/bothThemesTemplate.txt.twig', ':Templating:bothThemesTemplate.txt.twig|sylius/first-test-theme'],
['Templating/lastThemeTemplate.txt.twig', ':Templating:lastThemeTemplate.txt.twig|sylius/second-test-theme'],
['Templating/twigNamespacedVanillaTemplate.txt.twig', 'Templating/twigNamespacedVanillaTemplate.txt.twig'],
['Templating/twigNamespacedBothThemesTemplate.txt.twig', 'Templating/twigNamespacedBothThemesTemplate.txt.twig|sylius/first-test-theme'],
['Templating/twigNamespacedLastThemeTemplate.txt.twig', 'Templating/twigNamespacedLastThemeTemplate.txt.twig|sylius/second-test-theme'],
];
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
TestBundle:Templating:firstOverriddenTemplate.txt.twig
TestBundle:Templating:bothThemesTemplate.txt.twig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
TestBundle:Templating:lastOverriddenTemplate.txt.twig
TestBundle:Templating:lastThemeTemplate.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedBothThemesTemplate.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedLastThemeTemplate.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedVanillaOverriddenTemplate.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedVanillaOverriddenThemeTemplate.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedVanillaTemplate.txt.twig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
:Templating:firstOverriddenTemplate.txt.twig
:Templating:bothThemesTemplate.txt.twig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
:Templating:lastOverriddenTemplate.txt.twig
:Templating:lastThemeTemplate.txt.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ framework:
test: ~

twig:
paths: ['%kernel.project_dir%/templates']
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Templating/twigNamespacedBothThemesTemplate.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Templating/twigNamespacedLastThemeTemplate.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Templating/twigNamespacedVanillaTemplate.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedVanillaOverriddenTemplate.txt.twig (templates overridden)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Test/Templating/twigNamespacedVanillaOverriddenThemeTemplate.txt.twig (templates overridden)