merged branch lyrixx/tests (PR #1179)

This PR was squashed before being merged into the master branch (closes #1179).

Discussion
----------

Added Tests to prevent future regression

Theses tests do not pass at 1.13.0

could be linked to 1b0a54189c

Commits
-------

8410f8c Added Tests to prevent future regression
This commit is contained in:
Fabien Potencier
2013-09-02 14:28:12 +02:00
3 changed files with 22 additions and 0 deletions
+16
View File
@@ -124,4 +124,20 @@ class Twig_Tests_Loader_FilesystemTest extends PHPUnit_Framework_TestCase
// get index.html from the main namespace
$this->assertEquals("path\n", $loader->getSource('index.html'));
}
public function testLoadTemplateAndRenderBlockWithCache()
{
$loader = new Twig_Loader_Filesystem(array());
$loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme2');
$loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1');
$loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1', 'default_theme');
$twig = new Twig_Environment($loader);
$template = $twig->loadTemplate('blocks.html.twig');
$this->assertSame('block from theme 1', $template->renderBlock('b1', array()));
$template = $twig->loadTemplate('blocks.html.twig');
$this->assertSame('block from theme 2', $template->renderBlock('b2', array()));
}
}
@@ -0,0 +1,3 @@
{% block b1 %}block from theme 1{% endblock %}
{% block b2 %}block from theme 1{% endblock %}
@@ -0,0 +1,3 @@
{% use '@default_theme/blocks.html.twig' %}
{% block b2 %}block from theme 2{% endblock %}