Permalink
Browse files

Adding unit tests for exceptions.

  • Loading branch information...
1 parent b119ac2 commit e8b3eabdb6e1e6d737c8e47a1aa9a446859ce3c4 @zyxist zyxist committed Jul 10, 2011
Showing with 43 additions and 0 deletions.
  1. +1 −0 tests/TestSuite/AllTests.php
  2. +42 −0 tests/TestSuite/ExceptionTest.php
View
1 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');
View
42 tests/TestSuite/ExceptionTest.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Unit tests for Open Power Autoloader
+ *
+ * @author Tomasz "Zyx" Jędrzejewski
+ * @copyright Copyright (c) 2009 Invenzzia Group
+ * @license http://www.invenzzia.org/license/new-bsd New BSD License
+ */
+namespace TestSuite;
+use Opl\Autoloader\Exception\TranslationException;
+use Opl\Autoloader\Exception\FileNotFoundException;
+use Opl\Autoloader\Exception\FileFormatException;
+use RuntimeException;
+
+/**
+ * @covers Opl\Autoloader\Exception\TranslationException
+ * @covers Opl\Autoloader\Exception\FileNotFoundException
+ * @covers Opl\Autoloader\Exception\FileFormatException
+ */
+class ExceptionTest extends \PHPUnit_Framework_TestCase
+{
+ public function testTranslationException()
+ {
+ $exception = new TranslationException('Foo');
+ $this->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;

0 comments on commit e8b3eab

Please sign in to comment.