From f4ef3ba30e15661c35a40149956a5bdfda262e56 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sun, 16 May 2010 15:08:21 -0400 Subject: [PATCH] Added test case for multiple (trivial) invocations of Mustache::render --- test/MustacheTest.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/MustacheTest.php b/test/MustacheTest.php index f4d9672..06e1874 100644 --- a/test/MustacheTest.php +++ b/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. *