Explorar el Código

Merge branch 'feature/test-coverage' into dev

Justin Hileman hace 15 años
padre
commit
2c7663257d
Se han modificado 1 ficheros con 30 adiciones y 0 borrados
  1. 30 0
      test/MustacheTest.php

+ 30 - 0
test/MustacheTest.php

@@ -137,6 +137,36 @@ class MustacheTest extends PHPUnit_Framework_TestCase {
 		$this->assertEquals('Zappa, Frank', $m->render('{{last_name}}, {{first_name}}', array('first_name' => 'Frank', 'last_name' => 'Zappa')));
 	}
 
+	/**
+	 * Mustache should return the same thing when invoked multiple times.
+	 *
+	 * @access public
+	 * @return void
+	 */
+	public function testMultipleInvocations() {
+		$m = new Mustache('x');
+		$first = $m->render();
+		$second = $m->render();
+
+		$this->assertEquals('x', $first);
+		$this->assertEquals($first, $second);
+	}
+
+	/**
+	 * Mustache should return the same thing when invoked multiple times.
+	 *
+	 * @access public
+	 * @return void
+	 */
+	public function testMultipleInvocationsWithTags() {
+		$m = new Mustache('{{one}} {{two}}', array('one' => 'foo', 'two' => 'bar'));
+		$first = $m->render();
+		$second = $m->render();
+
+		$this->assertEquals('foo bar', $first);
+		$this->assertEquals($first, $second);
+	}
+
 	/**
 	 * Test everything in the `examples` directory.
 	 *