From e962cbac8c1e90574ae64c37f15afffe114f57c5 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Thu, 29 Apr 2010 19:24:44 -0400 Subject: [PATCH] Cleaned up UNKNOWN PRAGMA exception test. --- test/MustachePragmaTest.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/MustachePragmaTest.php b/test/MustachePragmaTest.php index 49937d1..db21269 100644 --- a/test/MustachePragmaTest.php +++ b/test/MustachePragmaTest.php @@ -7,17 +7,15 @@ class MustachePragmaTest extends PHPUnit_Framework_TestCase { public function testUnknownPragmaException() { $m = new Mustache(); - $caught_exception = null; try { $m->render('{{%I-HAVE-THE-GREATEST-MUSTACHE}}'); - } catch (Exception $e) { - $caught_exception = $e; + } catch (MustacheException $e) { + $this->assertEquals(MustacheException::UNKNOWN_PRAGMA, $e->getCode(), 'Caught exception code was not MustacheException::UNKNOWN_PRAGMA'); + return; } - $this->assertNotNull($caught_exception, 'No exception caught'); - $this->assertType('MustacheException', $caught_exception); - $this->assertEquals($caught_exception->getCode(), MustacheException::UNKNOWN_PRAGMA, 'Caught exception code was not MustacheException::UNKNOWN_PRAGMA'); + $this->fail('Mustache should have thrown an unknown pragma exception'); } public function testPragmaReplace() { @@ -37,4 +35,5 @@ class MustachePragmaTest extends PHPUnit_Framework_TestCase { $this->assertEquals($m->render("\n{{%DOT-NOTATION}}\n"), "\n", 'Too many newlines removed with pragma tag'); $this->assertEquals($m->render("1\n2{{%DOT-NOTATION}}\n3"), "1\n23", 'Wrong newline removed with pragma tag'); } + } \ No newline at end of file