replacement Exception() on InitializationException()

This commit is contained in:
Vyacheslav Agafonov
2011-11-24 16:10:06 +04:00
parent 6744eb6c4a
commit eebb013ecf
2 changed files with 5 additions and 4 deletions

View File

@ -16,6 +16,7 @@ require_once dirname(__FILE__) . '/../../view/helpers/ViewHelper.php';
require_once dirname(__FILE__) . '/../../view/helpers/TitleViewHelper.php'; require_once dirname(__FILE__) . '/../../view/helpers/TitleViewHelper.php';
require_once dirname(__FILE__) . '/../../view/PHPView.php'; require_once dirname(__FILE__) . '/../../view/PHPView.php';
require_once dirname(__FILE__) . '/../../exception/GeneralException.php'; require_once dirname(__FILE__) . '/../../exception/GeneralException.php';
require_once dirname(__FILE__) . '/../../exception/InitializationException.php';
require_once 'vfsStream/vfsStream.php'; require_once 'vfsStream/vfsStream.php';
class PHPViewTest extends PHPUnit_Framework_TestCase class PHPViewTest extends PHPUnit_Framework_TestCase
@ -45,7 +46,7 @@ class PHPViewTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Exception * @expectedException InitializationException
* @expectedExceptionMessage Configuration must have a "path" set. * @expectedExceptionMessage Configuration must have a "path" set.
*/ */
public function testPHPViewNullConstructor() public function testPHPViewNullConstructor()
@ -138,7 +139,7 @@ class PHPViewTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Exception * @expectedException InitializationException
* @expectedExceptionMessage Template * @expectedExceptionMessage Template
*/ */
public function testErrorTemplate() public function testErrorTemplate()

View File

@ -24,7 +24,7 @@ class PHPView implements iView
public function __construct($config) public function __construct($config)
{ {
if (!isset($config['path'])) { if (!isset($config['path'])) {
throw new Exception('Configuration must have a "path" set.'); throw new InitializationException('Configuration must have a "path" set.');
} }
$this->setPath($config['path']); $this->setPath($config['path']);
} }
@ -92,7 +92,7 @@ class PHPView implements iView
ob_start(); ob_start();
if (!is_readable($this->template)) { if (!is_readable($this->template)) {
ob_clean(); ob_clean();
throw new Exception('Template "' . $this->template .'" not found.'); throw new InitializationException('Template "' . $this->template .'" not found.');
} }
include($this->template); include($this->template);
return ob_get_clean(); return ob_get_clean();