فهرست منبع

Provide another interpolation failure test case.

Justin Hileman 14 سال پیش
والد
کامیت
61a0b7f2f2
1فایلهای تغییر یافته به همراه21 افزوده شده و 9 حذف شده
  1. 21 9
      test/MustacheTest.php

+ 21 - 9
test/MustacheTest.php

@@ -197,15 +197,27 @@ class MustacheTest extends PHPUnit_Framework_TestCase {
 	}
 	
 	/**
-	 * @group partials
+	 * @group interpolation
+	 * @dataProvider interpolationData
 	 */
-	public function testRenderDelimitersInSections() {
-		$m = new Mustache('{{#a}}{{=<% %>=}}{{b}} c<%={{ }}=%>{{/a}}');
-		$this->assertEquals('{{b}} c', $m->render(null, array(
-			'a' => array(
-				array('b' => 'Do Not Render')
-			)
-		)));
+	public function testDoubleRenderMustacheTags($template, $context, $expected) {
+		$m = new Mustache($template, $context);
+		$this->assertEquals($expected, $m->render());
+	}
+
+	public function interpolationData() {
+		return array(
+			array(
+				'{{#a}}{{=<% %>=}}{{b}} c<%={{ }}=%>{{/a}}',
+				array('a' => array(array('b' => 'Do Not Render'))),
+				'{{b}} c'
+			),
+			array(
+				'{{#a}}{{b}}{{/a}}',
+				array('a' => array('b' => '{{c}}'), 'c' => 'FAIL'),
+				'{{c}}'
+			),
+		);
 	}
 
 	/**
@@ -438,4 +450,4 @@ class MustacheExposedOptionsStub extends Mustache {
 	public function getDelimiters() {
 		return array($this->_otag, $this->_ctag);
 	}
-}
+}