mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 04:16:28 +00:00
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 to1b0a54189cCommits -------8410f8cAdded Tests to prevent future regression
This commit is contained in:
@@ -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