diff --git a/test/MustacheTest.php b/test/MustacheTest.php index 504b2d4..21714a7 100644 --- a/test/MustacheTest.php +++ b/test/MustacheTest.php @@ -349,4 +349,21 @@ class MustacheTest extends PHPUnit_Framework_TestCase { array('{{#foo}}{{/bar}}{{/foo}}'), ); } + + /** + * Ensure that Mustache doesn't double-render sections (allowing mustache injection). + * + * @group sections + */ + public function testMustacheInjection() { + $template = '{{#foo}}{{bar}}{{/foo}}'; + $view = array( + 'foo' => true, + 'bar' => '{{win}}', + 'win' => 'FAIL', + ); + + $m = new Mustache($template, $view); + $this->assertEquals('{{win}}', $m->render()); + } } \ No newline at end of file