Skip to content

Commit b3d4a15

Browse files
committed
Modify TwigExtensionTest to include bundle inheritance paths
1 parent 86c9111 commit b3d4a15

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection\Fixtures\Bundle\TwigResourcesBundle;
4+
5+
use Symfony\Component\HttpKernel\Bundle\Bundle;
6+
7+
class TwigResourcesBundle extends Bundle
8+
{
9+
public function getParent()
10+
{
11+
return 'TwigBundle';
12+
}
13+
}

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,12 @@ public function testTwigLoaderPaths($format)
152152
$this->compileContainer($container);
153153

154154
$def = $container->getDefinition('twig.loader.filesystem');
155-
$paths = array();
155+
$paths = array(); $prependPaths = array();
156156
foreach ($def->getMethodCalls() as $call) {
157157
if ('addPath' === $call[0] && false === strpos($call[1][0], 'Form')) {
158158
$paths[] = $call[1];
159+
} elseif ('prependPath' === $call[0]) {
160+
$prependPaths[] = $call[1];
159161
}
160162
}
161163

@@ -167,8 +169,13 @@ public function testTwigLoaderPaths($format)
167169
array('namespaced_path3', 'namespace3'),
168170
array(__DIR__.'/Fixtures/Resources/TwigBundle/views', 'Twig'),
169171
array(realpath(__DIR__.'/../..').'/Resources/views', 'Twig'),
172+
array(__DIR__.'/Fixtures/Bundle/TwigResourcesBundle/Resources/views', 'TwigResources'),
170173
array(__DIR__.'/Fixtures/Resources/views'),
171174
), $paths);
175+
176+
$this->assertEquals(array(
177+
array(__DIR__.'/Fixtures/Bundle/TwigResourcesBundle/Resources/views', 'Twig'),
178+
), $prependPaths);
172179
}
173180

174181
public function getFormats()
@@ -218,7 +225,10 @@ private function createContainer()
218225
'kernel.root_dir' => __DIR__.'/Fixtures',
219226
'kernel.charset' => 'UTF-8',
220227
'kernel.debug' => false,
221-
'kernel.bundles' => array('TwigBundle' => 'Symfony\\Bundle\\TwigBundle\\TwigBundle'),
228+
'kernel.bundles' => array(
229+
'TwigBundle' => 'Symfony\\Bundle\\TwigBundle\\TwigBundle',
230+
'TwigResourcesBundle' => 'Symfony\\Bundle\\TwigBundle\\Tests\\DependencyInjection\\Fixtures\\Bundle\\TwigResourcesBundle\\TwigResourcesBundle',
231+
),
222232
)));
223233

224234
return $container;

0 commit comments

Comments
 (0)