mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 20:06:31 +00:00
Added Tests to prevent future regression
This commit is contained in:
committed by
Fabien Potencier
parent
3db6b6aeb9
commit
8410f8caa9
@@ -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 %}
|
||||
Reference in New Issue
Block a user