|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the Symfony package. |
| 5 | + * |
| 6 | + * (c) Fabien Potencier <[email protected]> |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection\Compiler; |
| 13 | + |
| 14 | +use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass; |
| 15 | +use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 16 | +use Symfony\Component\DependencyInjection\Definition; |
| 17 | + |
| 18 | +class ExtensionPassTest extends \PHPUnit_Framework_TestCase |
| 19 | +{ |
| 20 | + public function testProcessDoesNotDropExistingFileLoaderMethodCalls() |
| 21 | + { |
| 22 | + $container = new ContainerBuilder(); |
| 23 | + $container->setParameter('kernel.debug', false); |
| 24 | + |
| 25 | + $container->register('twig.app_variable', '\Symfony\Bridge\Twig\AppVariable'); |
| 26 | + $container->register('templating', '\Symfony\Bundle\TwigBundle\TwigEngine'); |
| 27 | + |
| 28 | + $nativeTwigLoader = new Definition('\Twig_Loader_Filesystem'); |
| 29 | + $nativeTwigLoader->addMethodCall('addPath', array()); |
| 30 | + $container->setDefinition('twig.loader.native_filesystem', $nativeTwigLoader); |
| 31 | + |
| 32 | + $filesystemLoader = new Definition('\Symfony\Bundle\TwigBundle\Loader\FilesystemLoader'); |
| 33 | + $filesystemLoader->addMethodCall('addPath', array()); |
| 34 | + $container->setDefinition('twig.loader.filesystem', $filesystemLoader); |
| 35 | + |
| 36 | + $extensionPass = new ExtensionPass(); |
| 37 | + $extensionPass->process($container); |
| 38 | + |
| 39 | + $this->assertCount(2, $filesystemLoader->getMethodCalls()); |
| 40 | + } |
| 41 | +} |
0 commit comments