From f398e5ac6095971ee3c5823d561e831bc5095272 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 19 Aug 2007 20:34:11 +0000 Subject: [PATCH] Finishing the template unit test --- UnitTest/TemplateTest.php | 26 ++++++++++++++++++++++++++ UnitTest/templates/flush.test.tpl | 1 + 2 files changed, 27 insertions(+) create mode 100644 UnitTest/templates/flush.test.tpl diff --git a/UnitTest/TemplateTest.php b/UnitTest/TemplateTest.php index 42a1039..0658220 100644 --- a/UnitTest/TemplateTest.php +++ b/UnitTest/TemplateTest.php @@ -139,6 +139,32 @@ class TemplateTest extends PHPUnit_Framework_TestCase $this->fixture->cache(array('db.cache')); $this->assertEquals('store in the database, retouched', $this->fixture->fetch('db.cache')); } + + public function testFlush() + { + try + { + $this->fixture->flush(''); + $this->fail('exception expected'); + } + catch (Exception $e) + {} + + $a = 'foo'; + ob_start(); + $this->fixture->flush($this->fixture->fetch('flush')); + $data = ob_get_contents(); + ob_end_clean(); + $this->assertEquals('this is a $a test', $data); + + try + { + $this->fixture->flush($this->fixture->fetch('flush')); + $this->fail('exception expected'); + } + catch (Exception $e) + {} + } } ?> \ No newline at end of file diff --git a/UnitTest/templates/flush.test.tpl b/UnitTest/templates/flush.test.tpl new file mode 100644 index 0000000..be7fc8a --- /dev/null +++ b/UnitTest/templates/flush.test.tpl @@ -0,0 +1 @@ +this is a $a test \ No newline at end of file -- 2.43.5