소스 검색

Merge branch 'dev' into feature/whitespace-overhaul

Justin Hileman 15 년 전
부모
커밋
834d612f1e
1개의 변경된 파일17개의 추가작업 그리고 0개의 파일을 삭제
  1. 17 0
      test/MustacheTest.php

+ 17 - 0
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());
+	}
 }