mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-31 20:47:28 +00:00
Add tests when a template doesn't have output nodes
This commit is contained in:
@@ -123,6 +123,24 @@ class TemplateTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getRenderTemplateWithoutOutputData
|
||||
*/
|
||||
public function testRenderTemplateWithoutOutput(string $template)
|
||||
{
|
||||
$twig = new Environment(new ArrayLoader(['index' => $template]));
|
||||
$this->assertSame('', $twig->render('index'));
|
||||
}
|
||||
|
||||
public function getRenderTemplateWithoutOutputData()
|
||||
{
|
||||
return [
|
||||
[''],
|
||||
['{% for var in [] %}{% endfor %}'],
|
||||
['{% if false %}{% endif %}'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testRenderBlockWithUndefinedBlock()
|
||||
{
|
||||
$this->expectException(RuntimeError::class);
|
||||
|
||||
Reference in New Issue
Block a user