From e8b3eabdb6e1e6d737c8e47a1aa9a446859ce3c4 Mon Sep 17 00:00:00 2001 From: zyxist Date: Sun, 10 Jul 2011 09:30:44 +0200 Subject: [PATCH] Adding unit tests for exceptions. --- tests/TestSuite/AllTests.php | 1 + tests/TestSuite/ExceptionTest.php | 42 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 tests/TestSuite/ExceptionTest.php diff --git a/tests/TestSuite/AllTests.php b/tests/TestSuite/AllTests.php index 231b666..77c1107 100644 --- a/tests/TestSuite/AllTests.php +++ b/tests/TestSuite/AllTests.php @@ -14,6 +14,7 @@ public static function suite() { $suite = new AllTests('TestSuite'); + $suite->addTestSuite('TestSuite\\ExceptionTest'); $suite->addTestSuite('TestSuite\\GenericLoaderTest'); $suite->addTestSuite('TestSuite\\ClassMapLoaderTest'); $suite->addTestSuite('TestSuite\\PHARLoaderTest'); diff --git a/tests/TestSuite/ExceptionTest.php b/tests/TestSuite/ExceptionTest.php new file mode 100644 index 0000000..5c11cec --- /dev/null +++ b/tests/TestSuite/ExceptionTest.php @@ -0,0 +1,42 @@ +assertEquals('Foo', $exception->getMessage()); + $this->assertTrue($exception instanceof RuntimeException); + } // end testTranslationException(); + + public function testFileNotFoundException() + { + $exception = new FileNotFoundException('Foo'); + $this->assertEquals('Foo', $exception->getMessage()); + $this->assertTrue($exception instanceof RuntimeException); + } // end testFileNotFoundException(); + + public function testFileFormatException() + { + $exception = new FileFormatException('Foo'); + $this->assertEquals('Foo', $exception->getMessage()); + $this->assertTrue($exception instanceof RuntimeException); + } // end testFileFormatException(); +} // end ExceptionTest; \ No newline at end of file