Skip to content

Commit

Permalink
Adding unit tests for exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxist committed Jul 10, 2011
1 parent b119ac2 commit e8b3eab
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/TestSuite/AllTests.php
Expand Up @@ -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');
Expand Down
42 changes: 42 additions & 0 deletions 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.