mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-01 17:36:53 +00:00
Report a clear error when using macros imported in a template body that was not rendered
This commit is contained in:
@@ -480,7 +480,8 @@ class BlockChainTest extends TestCase
|
||||
try {
|
||||
$chain->renderBlock('field', ['helper' => 'macros1']);
|
||||
$this->fail('Rendering an uninitialized import must fail.');
|
||||
} catch (RuntimeError) {
|
||||
} catch (RuntimeError $e) {
|
||||
$this->assertStringContainsString('Macros imported in the body of template "theme" are not available because the body was not rendered', $e->getMessage());
|
||||
}
|
||||
|
||||
$this->assertSame('one', $twig->render('theme', ['helper' => 'macros1']));
|
||||
|
||||
Reference in New Issue
Block a user