added regression test

This commit is contained in:
Luis Cordova 2013-12-22 02:17:37 -05:00 committed by Christophe Coevoet
parent 4201d419a2
commit 9aa88e4494
8 changed files with 33 additions and 10 deletions

View File

@ -0,0 +1,7 @@
<?php
$container->loadFromExtension('twig', array(
'paths' => array(
'namespaced_path3' => 'namespace3',
),
));

View File

@ -22,7 +22,7 @@ $container->loadFromExtension('twig', array(
'paths' => array(
'path1',
'path2',
'namespaced_path1' => 'namespace',
'namespaced_path2' => 'namespace',
'namespaced_path1' => 'namespace1',
'namespaced_path2' => 'namespace2',
),
));

View File

@ -0,0 +1,12 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:twig="http://symfony.com/schema/dic/twig"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd">
<twig:config auto-reload="true" autoescape="true" base-template-class="stdClass" cache="/tmp" charset="ISO-8859-1" debug="true" strict-variables="true">
<twig:path namespace="namespace3">namespaced_path3</twig:path>
</twig:config>
</container>

View File

@ -15,7 +15,7 @@
<twig:global key="pi">3.14</twig:global>
<twig:path>path1</twig:path>
<twig:path>path2</twig:path>
<twig:path namespace="namespace">namespaced_path1</twig:path>
<twig:path namespace="namespace">namespaced_path2</twig:path>
<twig:path namespace="namespace1">namespaced_path1</twig:path>
<twig:path namespace="namespace2">namespaced_path2</twig:path>
</twig:config>
</container>

View File

@ -0,0 +1,3 @@
twig:
paths:
namespaced_path3: namespace3

View File

@ -17,5 +17,5 @@ twig:
paths:
path1: ''
path2: ''
namespaced_path1: namespace
namespaced_path2: namespace
namespaced_path1: namespace1
namespaced_path2: namespace2

View File

@ -145,6 +145,7 @@ class TwigExtensionTest extends TestCase
$container = $this->createContainer();
$container->registerExtension(new TwigExtension());
$this->loadFromFile($container, 'full', $format);
$this->loadFromFile($container, 'extra', $format);
$this->compileContainer($container);
$def = $container->getDefinition('twig.loader.filesystem');
@ -160,8 +161,9 @@ class TwigExtensionTest extends TestCase
$this->assertEquals(array(
array('path1'),
array('path2'),
array('namespaced_path1', 'namespace'),
array('namespaced_path2', 'namespace'),
array('namespaced_path1', 'namespace1'),
array('namespaced_path2', 'namespace2'),
array('namespaced_path3', 'namespace3'),
array(__DIR__.'/Fixtures/Resources/TwigBundle/views', 'Twig'),
array(realpath(__DIR__.'/../..').'/Resources/views', 'Twig'),
array(__DIR__.'/Fixtures/Resources/views'),

View File

@ -16,7 +16,6 @@ use Symfony\Component\Finder\Adapter;
class FinderTest extends Iterator\RealIteratorTestCase
{
public function testCreate()
{
$this->assertInstanceOf('Symfony\Component\Finder\Finder', Finder::create());
@ -796,7 +795,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
);
}
/**
/**
* Searching in multiple locations with sub directories involves
* AppendIterator which does an unnecessary rewind which leaves
* FilterIterator with inner FilesystemIterator in an invalid state.