From c4bc2d4b6139ee7fdebdaaa1570b6f5f2ab532ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Mon, 11 Mar 2019 22:45:24 +0100 Subject: [PATCH 01/14] Adds bundle view in a delayed compiler pass --- .../Compiler/BundleViewPathPass.php | 49 +++++++++++++++++++ .../DependencyInjection/TwigExtension.php | 10 ---- .../DependencyInjection/TwigExtensionTest.php | 9 ++-- src/Symfony/Bundle/TwigBundle/TwigBundle.php | 2 + 4 files changed, 57 insertions(+), 13 deletions(-) create mode 100644 src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php new file mode 100644 index 0000000000000..268aff97d9352 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler; + +use Symfony\Component\Config\Resource\FileExistenceResource; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Registers the bundles view paths. + */ +final class BundleViewPathPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + $twigFilesystemLoaderId = 'twig.loader.native_filesystem'; + if (false === $container->hasDefinition($twigFilesystemLoaderId)) { + return; + } + $twigFilesystemLoaderDefinition = $container->getDefinition($twigFilesystemLoaderId); + + foreach ($container->getParameter('kernel.bundles_metadata') as $name => $bundle) { + if (file_exists($dir = $bundle['path'].'/Resources/views')) { + $namespace = $this->normalizeBundleName($name); + $twigFilesystemLoaderDefinition->addMethodCall('addPath', [$dir, $namespace]); + $twigFilesystemLoaderDefinition->addMethodCall('addPath', [$dir, '!'.$namespace]); + } + $container->addResource(new FileExistenceResource($dir)); + } + } + + private function normalizeBundleName(string $name): string + { + if ('Bundle' === substr($name, -6)) { + $name = substr($name, 0, -6); + } + + return $name; + } +} diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php index 9e43596d438d6..f2771cddbb76a 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php @@ -113,11 +113,6 @@ public function load(array $configs, ContainerBuilder $container) foreach ($paths as $path) { $twigFilesystemLoaderDefinition->addMethodCall('addPath', [$path, $namespace]); } - - if ($paths) { - // the last path must be the bundle views directory - $twigFilesystemLoaderDefinition->addMethodCall('addPath', [$path, '!'.$namespace]); - } } if (file_exists($dir = $container->getParameter('kernel.root_dir').'/Resources/views')) { @@ -187,11 +182,6 @@ private function getBundleTemplatePaths(ContainerBuilder $container, array $conf $bundleHierarchy[$name][] = $defaultOverrideBundlePath; } $container->addResource(new FileExistenceResource($defaultOverrideBundlePath)); - - if (file_exists($dir = $bundle['path'].'/Resources/views')) { - $bundleHierarchy[$name][] = $dir; - } - $container->addResource(new FileExistenceResource($dir)); } return $bundleHierarchy; diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 48077f89aaf92..dd97b88ec86f8 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection; +use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\BundleViewPathPass; use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\RuntimeLoaderPass; use Symfony\Bundle\TwigBundle\DependencyInjection\TwigExtension; use Symfony\Bundle\TwigBundle\Tests\TestCase; @@ -177,6 +178,7 @@ public function testTwigLoaderPaths($format) $container->registerExtension(new TwigExtension()); $this->loadFromFile($container, 'full', $format); $this->loadFromFile($container, 'extra', $format); + $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_REMOVING); $this->compileContainer($container); $def = $container->getDefinition('twig.loader.native_filesystem'); @@ -194,9 +196,9 @@ public function testTwigLoaderPaths($format) ['namespaced_path2', 'namespace2'], ['namespaced_path3', 'namespace3'], [__DIR__.'/Fixtures/templates/bundles/TwigBundle', 'Twig'], + [__DIR__.'/Fixtures/templates'], [realpath(__DIR__.'/../..').'/Resources/views', 'Twig'], [realpath(__DIR__.'/../..').'/Resources/views', '!Twig'], - [__DIR__.'/Fixtures/templates'], ], $paths); } @@ -212,6 +214,7 @@ public function testLegacyTwigLoaderPaths($format) $container->registerExtension(new TwigExtension()); $this->loadFromFile($container, 'full', $format); $this->loadFromFile($container, 'extra', $format); + $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_REMOVING); $this->compileContainer($container); $def = $container->getDefinition('twig.loader.native_filesystem'); @@ -230,10 +233,10 @@ public function testLegacyTwigLoaderPaths($format) ['namespaced_path3', 'namespace3'], [__DIR__.'/../Fixtures/templates/Resources/TwigBundle/views', 'Twig'], [__DIR__.'/Fixtures/templates/bundles/TwigBundle', 'Twig'], - [realpath(__DIR__.'/../..').'/Resources/views', 'Twig'], - [realpath(__DIR__.'/../..').'/Resources/views', '!Twig'], [__DIR__.'/../Fixtures/templates/Resources/views'], [__DIR__.'/Fixtures/templates'], + [realpath(__DIR__.'/../..').'/Resources/views', 'Twig'], + [realpath(__DIR__.'/../..').'/Resources/views', '!Twig'], ], $paths); } diff --git a/src/Symfony/Bundle/TwigBundle/TwigBundle.php b/src/Symfony/Bundle/TwigBundle/TwigBundle.php index bd766c15219e7..df0d4555cbe9c 100644 --- a/src/Symfony/Bundle/TwigBundle/TwigBundle.php +++ b/src/Symfony/Bundle/TwigBundle/TwigBundle.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\TwigBundle; +use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\BundleViewPathPass; use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExceptionListenerPass; use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass; use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\RuntimeLoaderPass; @@ -37,6 +38,7 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new TwigLoaderPass()); $container->addCompilerPass(new ExceptionListenerPass()); $container->addCompilerPass(new RuntimeLoaderPass(), PassConfig::TYPE_BEFORE_REMOVING); + $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_REMOVING); } public function registerCommands(Application $application) From 9316613cd9d92fd0e41e6614cfd814e9b21fa4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Tue, 12 Mar 2019 12:16:21 +0100 Subject: [PATCH 02/14] Takes account of ExtensionPass that allows to use another filesystem loader --- .../Compiler/BundleViewPathPass.php | 13 ++++++++++--- .../Tests/DependencyInjection/TwigExtensionTest.php | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php index 268aff97d9352..d125aebc72967 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php @@ -22,11 +22,18 @@ final class BundleViewPathPass implements CompilerPassInterface { public function process(ContainerBuilder $container) { - $twigFilesystemLoaderId = 'twig.loader.native_filesystem'; - if (false === $container->hasDefinition($twigFilesystemLoaderId)) { + $twigFilesystemLoaderId = 'twig.loader.filesystem'; + if ($container->hasDefinition($twigFilesystemLoaderId)) { + $twigFilesystemLoaderDefinition = $container->getDefinition($twigFilesystemLoaderId); + } elseif ($container->hasAlias($twigFilesystemLoaderId)) { + $aliasedService = (string) $container->getAlias($twigFilesystemLoaderId); + if (false === $container->hasDefinition($aliasedService)) { + return; + } + $twigFilesystemLoaderDefinition = $container->getDefinition($aliasedService); + } else { return; } - $twigFilesystemLoaderDefinition = $container->getDefinition($twigFilesystemLoaderId); foreach ($container->getParameter('kernel.bundles_metadata') as $name => $bundle) { if (file_exists($dir = $bundle['path'].'/Resources/views')) { diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index dd97b88ec86f8..f13e7e56a59c8 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -12,6 +12,7 @@ namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection; use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\BundleViewPathPass; +use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass; use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\RuntimeLoaderPass; use Symfony\Bundle\TwigBundle\DependencyInjection\TwigExtension; use Symfony\Bundle\TwigBundle\Tests\TestCase; @@ -178,6 +179,7 @@ public function testTwigLoaderPaths($format) $container->registerExtension(new TwigExtension()); $this->loadFromFile($container, 'full', $format); $this->loadFromFile($container, 'extra', $format); + $container->addCompilerPass(new ExtensionPass()); $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_REMOVING); $this->compileContainer($container); @@ -214,6 +216,7 @@ public function testLegacyTwigLoaderPaths($format) $container->registerExtension(new TwigExtension()); $this->loadFromFile($container, 'full', $format); $this->loadFromFile($container, 'extra', $format); + $container->addCompilerPass(new ExtensionPass()); $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_REMOVING); $this->compileContainer($container); From 0e717e8fd26f939f94a2c167efd69b04f85250a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Tue, 12 Mar 2019 16:17:11 +0100 Subject: [PATCH 03/14] Use ContainerBuilder::findDefinition method --- .../Compiler/BundleViewPathPass.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php index d125aebc72967..e0880be14f010 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/BundleViewPathPass.php @@ -22,18 +22,7 @@ final class BundleViewPathPass implements CompilerPassInterface { public function process(ContainerBuilder $container) { - $twigFilesystemLoaderId = 'twig.loader.filesystem'; - if ($container->hasDefinition($twigFilesystemLoaderId)) { - $twigFilesystemLoaderDefinition = $container->getDefinition($twigFilesystemLoaderId); - } elseif ($container->hasAlias($twigFilesystemLoaderId)) { - $aliasedService = (string) $container->getAlias($twigFilesystemLoaderId); - if (false === $container->hasDefinition($aliasedService)) { - return; - } - $twigFilesystemLoaderDefinition = $container->getDefinition($aliasedService); - } else { - return; - } + $twigFilesystemLoaderDefinition = $container->findDefinition('twig.loader.filesystem'); foreach ($container->getParameter('kernel.bundles_metadata') as $name => $bundle) { if (file_exists($dir = $bundle['path'].'/Resources/views')) { From adf7bc82d232cecc7e1fbab94541dcbc3ccdcd97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Tue, 12 Mar 2019 16:34:12 +0100 Subject: [PATCH 04/14] Better way to order compiler pass --- src/Symfony/Bundle/TwigBundle/TwigBundle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/TwigBundle.php b/src/Symfony/Bundle/TwigBundle/TwigBundle.php index df0d4555cbe9c..70be63495c450 100644 --- a/src/Symfony/Bundle/TwigBundle/TwigBundle.php +++ b/src/Symfony/Bundle/TwigBundle/TwigBundle.php @@ -37,8 +37,8 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new TwigEnvironmentPass()); $container->addCompilerPass(new TwigLoaderPass()); $container->addCompilerPass(new ExceptionListenerPass()); + $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -16); $container->addCompilerPass(new RuntimeLoaderPass(), PassConfig::TYPE_BEFORE_REMOVING); - $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_REMOVING); } public function registerCommands(Application $application) From 376f09d198a164a2a5e54d6c29e4ff10801084cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Tue, 12 Mar 2019 23:30:01 +0100 Subject: [PATCH 05/14] Make test take account of compiler priority --- .../Tests/DependencyInjection/TwigExtensionTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index f13e7e56a59c8..d18936551025e 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -180,7 +180,7 @@ public function testTwigLoaderPaths($format) $this->loadFromFile($container, 'full', $format); $this->loadFromFile($container, 'extra', $format); $container->addCompilerPass(new ExtensionPass()); - $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_REMOVING); + $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -16); $this->compileContainer($container); $def = $container->getDefinition('twig.loader.native_filesystem'); @@ -217,7 +217,7 @@ public function testLegacyTwigLoaderPaths($format) $this->loadFromFile($container, 'full', $format); $this->loadFromFile($container, 'extra', $format); $container->addCompilerPass(new ExtensionPass()); - $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_REMOVING); + $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -16); $this->compileContainer($container); $def = $container->getDefinition('twig.loader.native_filesystem'); From 1841faf55d14fde0753f07f8af0846127ec18a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Wed, 13 Mar 2019 00:04:55 +0100 Subject: [PATCH 06/14] Adds test with 3rd-party bundles whom first overrides second one's templates --- .../bundles/BarBundle/layout.html.twig | 2 +- .../bundles/TwigBundle/layout.html.twig | 2 +- .../DependencyInjection/TwigExtensionTest.php | 81 ++++++++++++++++++- 3 files changed, 81 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/templates/bundles/BarBundle/layout.html.twig b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/templates/bundles/BarBundle/layout.html.twig index bb07ecfe55a36..34a830706f7ea 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/templates/bundles/BarBundle/layout.html.twig +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/templates/bundles/BarBundle/layout.html.twig @@ -1 +1 @@ -This is a layout +This is user-defined BarBundle layout diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/templates/bundles/TwigBundle/layout.html.twig b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/templates/bundles/TwigBundle/layout.html.twig index bb07ecfe55a36..1f9cbfa5ab945 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/templates/bundles/TwigBundle/layout.html.twig +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/templates/bundles/TwigBundle/layout.html.twig @@ -1 +1 @@ -This is a layout +This is TwigBundle layout diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index d18936551025e..6b3eca2e66778 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -24,6 +24,7 @@ use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Reference; +use ThirdParty\BarExtensionBundle\DependencyInjection\Compiler\OverrideBarBundlePathPass; class TwigExtensionTest extends TestCase { @@ -183,8 +184,9 @@ public function testTwigLoaderPaths($format) $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -16); $this->compileContainer($container); - $def = $container->getDefinition('twig.loader.native_filesystem'); + $def = $container->findDefinition('twig.loader.filesystem'); $paths = []; + foreach ($def->getMethodCalls() as $call) { if ('addPath' === $call[0] && false === strpos($call[1][0], 'Form')) { $paths[] = $call[1]; @@ -198,9 +200,12 @@ public function testTwigLoaderPaths($format) ['namespaced_path2', 'namespace2'], ['namespaced_path3', 'namespace3'], [__DIR__.'/Fixtures/templates/bundles/TwigBundle', 'Twig'], + // [__DIR__.'/Fixtures/templates/bundles/BarBundle', 'Bar'], [__DIR__.'/Fixtures/templates'], [realpath(__DIR__.'/../..').'/Resources/views', 'Twig'], [realpath(__DIR__.'/../..').'/Resources/views', '!Twig'], + // [realpath(__DIR__.'/../..').'/Resources/views', 'Bar'], + // [realpath(__DIR__.'/../..').'/Resources/views', '!Bar'], ], $paths); } @@ -220,7 +225,7 @@ public function testLegacyTwigLoaderPaths($format) $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -16); $this->compileContainer($container); - $def = $container->getDefinition('twig.loader.native_filesystem'); + $def = $container->findDefinition('twig.loader.filesystem'); $paths = []; foreach ($def->getMethodCalls() as $call) { if ('addPath' === $call[0] && false === strpos($call[1][0], 'Form')) { @@ -243,6 +248,78 @@ public function testLegacyTwigLoaderPaths($format) ], $paths); } + /** + * @dataProvider getFormats + */ + public function testThirdPartyBundlesMayOverrideBetweenThem($format) + { + $container = $this->createContainer(); + $container->registerExtension(new TwigExtension()); + $this->loadFromFile($container, 'full', $format); + $this->loadFromFile($container, 'extra', $format); + $container->addCompilerPass(new ExtensionPass()); + $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -16); + // Adds 2 third-party bundles whom second overrides first one's templates + require_once(__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/BarExtensionBundle.php'); + require_once(__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php'); + $container->setParameter( + 'kernel.bundles', + \array_merge( + $container->getParameter('kernel.bundles'), + [ + 'BarBundle' => 'ThirdParty\\BarBundle\\BarBundle', + 'BarExtensionBundle' => 'ThirdParty\\BarExtensionBundle\\BarExtensionBundle', + ] + ) + ); + $container->setParameter( + 'kernel.bundles_metadata', + \array_merge( + $container->getParameter('kernel.bundles_metadata'), + [ + 'BarBundle' => [ + 'namespace' => 'ThirdParty\\BarBundle', + 'path' => realpath(__DIR__.'/Fixtures/vendor/third-party/BarBundle'), + ], + 'BarExtensionBundle' => [ + 'namespace' => 'ThirdParty\\BarExtensionBundle', + 'path' => realpath(__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle'), + ], + ] + ) + ); + $container->addCompilerPass(new OverrideBarBundlePathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION); + + $this->compileContainer($container); + + $def = $container->findDefinition('twig.loader.filesystem'); + $paths = []; + + foreach ($def->getMethodCalls() as $call) { + if ('addPath' === $call[0] && false === strpos($call[1][0], 'Form')) { + $paths[] = $call[1]; + } + } + + $this->assertEquals([ + ['path1'], + ['path2'], + ['namespaced_path1', 'namespace1'], + ['namespaced_path2', 'namespace2'], + ['namespaced_path3', 'namespace3'], + [__DIR__.'/Fixtures/templates/bundles/TwigBundle', 'Twig'], + [__DIR__.'/Fixtures/templates/bundles/BarBundle', 'Bar'], + [__DIR__.'/Fixtures/templates'], + [__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/Resources/views', 'Bar'], + [realpath(__DIR__.'/../..').'/Resources/views', 'Twig'], + [realpath(__DIR__.'/../..').'/Resources/views', '!Twig'], + [__DIR__.'/Fixtures/vendor/third-party/BarBundle/Resources/views', 'Bar'], + [__DIR__.'/Fixtures/vendor/third-party/BarBundle/Resources/views', '!Bar'], + [__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/Resources/views', 'BarExtension'], + [__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/Resources/views', '!BarExtension'], + ], $paths); + } + public function getFormats() { return [ From 5fa2c453936d9a0f2e18470438dc08c452539e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Wed, 13 Mar 2019 00:06:50 +0100 Subject: [PATCH 07/14] coding standard --- .../Tests/DependencyInjection/TwigExtensionTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 6b3eca2e66778..4fb5dffd74a1c 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -260,8 +260,8 @@ public function testThirdPartyBundlesMayOverrideBetweenThem($format) $container->addCompilerPass(new ExtensionPass()); $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -16); // Adds 2 third-party bundles whom second overrides first one's templates - require_once(__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/BarExtensionBundle.php'); - require_once(__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php'); + require_once __DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/BarExtensionBundle.php'; + require_once __DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php'; $container->setParameter( 'kernel.bundles', \array_merge( From 31c48250afe9f2a2a5dfa6a83088417e4fc2822a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Wed, 13 Mar 2019 00:14:35 +0100 Subject: [PATCH 08/14] Trying fix test on AppVeyor/Travis --- .../Tests/DependencyInjection/TwigExtensionTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 4fb5dffd74a1c..d8ed7b44527b5 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -260,8 +260,8 @@ public function testThirdPartyBundlesMayOverrideBetweenThem($format) $container->addCompilerPass(new ExtensionPass()); $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -16); // Adds 2 third-party bundles whom second overrides first one's templates - require_once __DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/BarExtensionBundle.php'; - require_once __DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php'; + require_once realpath(__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/BarExtensionBundle.php'); + require_once realpath(__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php'); $container->setParameter( 'kernel.bundles', \array_merge( From c2bedda34d3bdfdfa6989952affa252525a271e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Wed, 13 Mar 2019 00:26:59 +0100 Subject: [PATCH 09/14] try fixing include_path issue with CI --- .../Tests/DependencyInjection/TwigExtensionTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index d8ed7b44527b5..84b4453a0385b 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -260,8 +260,8 @@ public function testThirdPartyBundlesMayOverrideBetweenThem($format) $container->addCompilerPass(new ExtensionPass()); $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -16); // Adds 2 third-party bundles whom second overrides first one's templates - require_once realpath(__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/BarExtensionBundle.php'); - require_once realpath(__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php'); + require_once realpath(__DIR__).'/Fixtures/vendor/third-party/BarExtensionBundle/BarExtensionBundle.php'; + require_once realpath(__DIR__).'/Fixtures/vendor/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php'; $container->setParameter( 'kernel.bundles', \array_merge( From 9e89470c5539f179fb9148687826115e884ba63f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Wed, 13 Mar 2019 10:04:18 +0100 Subject: [PATCH 10/14] Fix ignored vendor path --- .../Resources/views/layout.html.twig | 1 + .../BarExtensionBundle/BarExtensionBundle.php | 27 +++++++++++++++++++ .../Compiler/OverrideBarBundlePathPass.php | 26 ++++++++++++++++++ .../Resources/views/layout.html.twig | 1 + .../DependencyInjection/TwigExtensionTest.php | 21 +++++++-------- 5 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarBundle/Resources/views/layout.html.twig create mode 100644 src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/BarExtensionBundle.php create mode 100644 src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php create mode 100644 src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/Resources/views/layout.html.twig diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarBundle/Resources/views/layout.html.twig b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarBundle/Resources/views/layout.html.twig new file mode 100644 index 0000000000000..371c9a7d25b50 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarBundle/Resources/views/layout.html.twig @@ -0,0 +1 @@ +This is base BarBundle layout diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/BarExtensionBundle.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/BarExtensionBundle.php new file mode 100644 index 0000000000000..a7301c23f5908 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/BarExtensionBundle.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ThirdParty\BarExtensionBundle; + +use Symfony\Component\DependencyInjection\Compiler\PassConfig; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\Bundle\Bundle; +use ThirdParty\BarExtensionBundle\DependencyInjection\Compiler\OverrideBarBundlePathPass; + +class BarExtensionBundle extends Bundle +{ + public function build(ContainerBuilder $container) + { + parent::build($container); + + $container->addCompilerPass(new OverrideBarBundlePathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION); + } +} diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php new file mode 100644 index 0000000000000..558cce658d75a --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php @@ -0,0 +1,26 @@ +findDefinition('twig.loader.filesystem'); + + // Replaces native Bar templates + $barExtensionBundleRefl = new \ReflectionClass(BarExtensionBundle::class); + if ($barExtensionBundleRefl->isUserDefined()) { + $barExtensionBundlePath = \dirname((string) $barExtensionBundleRefl->getFileName()); + $barExtensionBundleTwigPath = $barExtensionBundlePath.'/Resources/views'; + $twigLoaderFilesystemDefinition->addMethodCall( + 'addPath', + [$barExtensionBundleTwigPath, 'Bar'] + ); + } + } +} diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/Resources/views/layout.html.twig b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/Resources/views/layout.html.twig new file mode 100644 index 0000000000000..d5a847f30f4f1 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/third-party/BarExtensionBundle/Resources/views/layout.html.twig @@ -0,0 +1 @@ +This is BarExtensionBundle override of BarBundle layout diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 84b4453a0385b..0972e10ec0b66 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -200,12 +200,9 @@ public function testTwigLoaderPaths($format) ['namespaced_path2', 'namespace2'], ['namespaced_path3', 'namespace3'], [__DIR__.'/Fixtures/templates/bundles/TwigBundle', 'Twig'], - // [__DIR__.'/Fixtures/templates/bundles/BarBundle', 'Bar'], [__DIR__.'/Fixtures/templates'], [realpath(__DIR__.'/../..').'/Resources/views', 'Twig'], [realpath(__DIR__.'/../..').'/Resources/views', '!Twig'], - // [realpath(__DIR__.'/../..').'/Resources/views', 'Bar'], - // [realpath(__DIR__.'/../..').'/Resources/views', '!Bar'], ], $paths); } @@ -260,8 +257,8 @@ public function testThirdPartyBundlesMayOverrideBetweenThem($format) $container->addCompilerPass(new ExtensionPass()); $container->addCompilerPass(new BundleViewPathPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -16); // Adds 2 third-party bundles whom second overrides first one's templates - require_once realpath(__DIR__).'/Fixtures/vendor/third-party/BarExtensionBundle/BarExtensionBundle.php'; - require_once realpath(__DIR__).'/Fixtures/vendor/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php'; + require_once __DIR__.'/Fixtures/third-party/BarExtensionBundle/BarExtensionBundle.php'; + require_once __DIR__.'/Fixtures/third-party/BarExtensionBundle/DependencyInjection/Compiler/OverrideBarBundlePathPass.php'; $container->setParameter( 'kernel.bundles', \array_merge( @@ -279,11 +276,11 @@ public function testThirdPartyBundlesMayOverrideBetweenThem($format) [ 'BarBundle' => [ 'namespace' => 'ThirdParty\\BarBundle', - 'path' => realpath(__DIR__.'/Fixtures/vendor/third-party/BarBundle'), + 'path' => __DIR__.'/Fixtures/third-party/BarBundle', ], 'BarExtensionBundle' => [ 'namespace' => 'ThirdParty\\BarExtensionBundle', - 'path' => realpath(__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle'), + 'path' => __DIR__.'/Fixtures/third-party/BarExtensionBundle', ], ] ) @@ -310,13 +307,13 @@ public function testThirdPartyBundlesMayOverrideBetweenThem($format) [__DIR__.'/Fixtures/templates/bundles/TwigBundle', 'Twig'], [__DIR__.'/Fixtures/templates/bundles/BarBundle', 'Bar'], [__DIR__.'/Fixtures/templates'], - [__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/Resources/views', 'Bar'], + [__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views', 'Bar'], [realpath(__DIR__.'/../..').'/Resources/views', 'Twig'], [realpath(__DIR__.'/../..').'/Resources/views', '!Twig'], - [__DIR__.'/Fixtures/vendor/third-party/BarBundle/Resources/views', 'Bar'], - [__DIR__.'/Fixtures/vendor/third-party/BarBundle/Resources/views', '!Bar'], - [__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/Resources/views', 'BarExtension'], - [__DIR__.'/Fixtures/vendor/third-party/BarExtensionBundle/Resources/views', '!BarExtension'], + [__DIR__.'/Fixtures/third-party/BarBundle/Resources/views', 'Bar'], + [__DIR__.'/Fixtures/third-party/BarBundle/Resources/views', '!Bar'], + [__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views', 'BarExtension'], + [__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views', '!BarExtension'], ], $paths); } From d1959267141afdf2996e38921ee5ae1fb7088429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Wed, 13 Mar 2019 10:17:21 +0100 Subject: [PATCH 11/14] Use realpath to prevent from Windows path mismatch --- .../DependencyInjection/TwigExtensionTest.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 0972e10ec0b66..7ec989a5ba023 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -304,16 +304,16 @@ public function testThirdPartyBundlesMayOverrideBetweenThem($format) ['namespaced_path1', 'namespace1'], ['namespaced_path2', 'namespace2'], ['namespaced_path3', 'namespace3'], - [__DIR__.'/Fixtures/templates/bundles/TwigBundle', 'Twig'], - [__DIR__.'/Fixtures/templates/bundles/BarBundle', 'Bar'], - [__DIR__.'/Fixtures/templates'], - [__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views', 'Bar'], - [realpath(__DIR__.'/../..').'/Resources/views', 'Twig'], - [realpath(__DIR__.'/../..').'/Resources/views', '!Twig'], - [__DIR__.'/Fixtures/third-party/BarBundle/Resources/views', 'Bar'], - [__DIR__.'/Fixtures/third-party/BarBundle/Resources/views', '!Bar'], - [__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views', 'BarExtension'], - [__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views', '!BarExtension'], + [realpath(__DIR__.'/Fixtures/templates/bundles/TwigBundle'), 'Twig'], + [realpath(__DIR__.'/Fixtures/templates/bundles/BarBundle'), 'Bar'], + [realpath(__DIR__.'/Fixtures/templates')], + [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views'), 'Bar'], + [realpath(__DIR__.'/../../Resources/views'), 'Twig'], + [realpath(__DIR__.'/../../Resources/views'), '!Twig'], + [realpath(__DIR__.'/Fixtures/third-party/BarBundle/Resources/views'), 'Bar'], + [realpath(__DIR__.'/Fixtures/third-party/BarBundle/Resources/views'), '!Bar'], + [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views'), 'BarExtension'], + [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views'), '!BarExtension'], ], $paths); } From 8e18e4223533c04f2d448252a820f33a06cfe06b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Wed, 13 Mar 2019 11:54:01 +0100 Subject: [PATCH 12/14] Dealing with AppVeyor windows path for CI --- .../Tests/DependencyInjection/TwigExtensionTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 7ec989a5ba023..6c08bc5f453dc 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -310,10 +310,10 @@ public function testThirdPartyBundlesMayOverrideBetweenThem($format) [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views'), 'Bar'], [realpath(__DIR__.'/../../Resources/views'), 'Twig'], [realpath(__DIR__.'/../../Resources/views'), '!Twig'], - [realpath(__DIR__.'/Fixtures/third-party/BarBundle/Resources/views'), 'Bar'], - [realpath(__DIR__.'/Fixtures/third-party/BarBundle/Resources/views'), '!Bar'], - [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views'), 'BarExtension'], - [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views'), '!BarExtension'], + [realpath(__DIR__.'/Fixtures/third-party/BarBundle').'/Resources/views', 'Bar'], + [realpath(__DIR__.'/Fixtures/third-party/BarBundle').'/Resources/views', '!Bar'], + [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle').'/Resources/views', 'BarExtension'], + [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle').'/Resources/views', '!BarExtension'], ], $paths); } From 69201449fa0da11211e7d439ef94fbd032635222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Thu, 14 Mar 2019 00:20:18 +0100 Subject: [PATCH 13/14] Stuck with these AppVeyor Windows paths --- .../DependencyInjection/TwigExtensionTest.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 6c08bc5f453dc..638780c3ea4f9 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -304,16 +304,16 @@ public function testThirdPartyBundlesMayOverrideBetweenThem($format) ['namespaced_path1', 'namespace1'], ['namespaced_path2', 'namespace2'], ['namespaced_path3', 'namespace3'], - [realpath(__DIR__.'/Fixtures/templates/bundles/TwigBundle'), 'Twig'], - [realpath(__DIR__.'/Fixtures/templates/bundles/BarBundle'), 'Bar'], - [realpath(__DIR__.'/Fixtures/templates')], - [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle/Resources/views'), 'Bar'], - [realpath(__DIR__.'/../../Resources/views'), 'Twig'], - [realpath(__DIR__.'/../../Resources/views'), '!Twig'], - [realpath(__DIR__.'/Fixtures/third-party/BarBundle').'/Resources/views', 'Bar'], - [realpath(__DIR__.'/Fixtures/third-party/BarBundle').'/Resources/views', '!Bar'], - [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle').'/Resources/views', 'BarExtension'], - [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle').'/Resources/views', '!BarExtension'], + [realpath(__DIR__).'/Fixtures/templates/bundles/TwigBundle', 'Twig'], + [realpath(__DIR__).'/Fixtures/templates/bundles/BarBundle', 'Bar'], + [realpath(__DIR__).'/Fixtures/templates'], + [realpath(__DIR__).'/Fixtures/third-party/BarExtensionBundle/Resources/views', 'Bar'], + [realpath(__DIR__.'/../..').'/Resources/views', 'Twig'], + [realpath(__DIR__.'/../..').'/Resources/views', '!Twig'], + [realpath(__DIR__).'/Fixtures/third-party/BarBundle/Resources/views', 'Bar'], + [realpath(__DIR__).'/Fixtures/third-party/BarBundle/Resources/views', '!Bar'], + [realpath(__DIR__).'/Fixtures/third-party/BarExtensionBundle/Resources/views', 'BarExtension'], + [realpath(__DIR__).'/Fixtures/third-party/BarExtensionBundle/Resources/views', '!BarExtension'], ], $paths); } From f3f641bb321c60fbbcc154d0a549982439962b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Thu, 14 Mar 2019 00:31:06 +0100 Subject: [PATCH 14/14] Last dance to fix Windows paths --- .../TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 638780c3ea4f9..331e738e8345a 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -307,7 +307,7 @@ public function testThirdPartyBundlesMayOverrideBetweenThem($format) [realpath(__DIR__).'/Fixtures/templates/bundles/TwigBundle', 'Twig'], [realpath(__DIR__).'/Fixtures/templates/bundles/BarBundle', 'Bar'], [realpath(__DIR__).'/Fixtures/templates'], - [realpath(__DIR__).'/Fixtures/third-party/BarExtensionBundle/Resources/views', 'Bar'], + [realpath(__DIR__.'/Fixtures/third-party/BarExtensionBundle').'/Resources/views', 'Bar'], [realpath(__DIR__.'/../..').'/Resources/views', 'Twig'], [realpath(__DIR__.'/../..').'/Resources/views', '!Twig'], [realpath(__DIR__).'/Fixtures/third-party/BarBundle/Resources/views', 'Bar'],