Added test case for multiple (trivial) invocations of Mustache::render

This commit is contained in:
Justin Hileman
2010-05-16 15:08:21 -04:00
parent ca8e96de97
commit f4ef3ba30e
+30
View File
@@ -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'))); $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. * Test everything in the `examples` directory.
* *