8000 Modify TwigExtensionTest to include bundle inheritance paths · symfony/symfony@4ddc9ed · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ddc9ed

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

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,12 @@ public function testTwigLoaderPaths($format)
153153

154154
$def = $container->getDefinition('twig.loader.filesystem');
155155
$paths = array();
156+
$prependPaths = array();
156157
foreach ($def->getMethodCalls() as $call) {
157158
if ('addPath' === $call[0] && false === strpos($call[1][0], 'Form')) {
158159
$paths[] = $call[1];
160+
} elseif ('prependPath' === $call[0]) {
161+
$prependPaths[] = $call[1];
159162
}
160163
}
161164

@@ -167,8 +170,13 @@ public function testTwigLoaderPaths($format)
167170
array('namespaced_path3', 'namespace3'),
168171
array(__DIR__.'/Fixtures/Resources/TwigBundle/views', 'Twig'),
169172
array(realpath(__DIR__.'/../..').'/Resources/views', 'Twig'),
173+
array(__DIR__.'/Fixtures/Bundle/TwigResourcesBundle/Resources/views', 'TwigResources'),
170174
array(__DIR__.'/Fixtures/Resources/views'),
171175
), $paths);
176+
177+
$this->assertEquals(array(
178+
array(__DIR__.'/Fixtures/Bundle/TwigResourcesBundle/Resources/views', 'Twig'),
179+
), $prependPaths);
172180
}
173181

174182
public function getFormats()
@@ -218,7 +226,10 @@ private function createContainer()
218226
'kernel.root_dir' => __DIR__.'/Fixtures',
219227
'kernel.charset' => 'UTF-8',
220228
'kernel.debug' => false,
221-
'kernel.bundles' => array('TwigBundle' => 'Symfony\\Bundle\\TwigBundle\\TwigBundle'),
229+
'kernel.bundles' => array(
230+
'TwigBundle' => 'Symfony\\Bundle\\TwigBundle\\TwigBundle',
231+
'TwigResourcesBundle' => 'Symfony\\Bundle\\TwigBundle\\Tests\\DependencyInjection\\Fixtures\\Bundle\\TwigResourcesBundle\\TwigResourcesBundle',
232+
),
222233
)));
223234

224235
return $container;

0 commit comments

Comments
 (0)
0