diff --git a/tests/view/helpers/MsgViewHelperTest.php b/tests/view/helpers/MsgViewHelperTest.php index 418c2e0..a369d3f 100644 --- a/tests/view/helpers/MsgViewHelperTest.php +++ b/tests/view/helpers/MsgViewHelperTest.php @@ -15,6 +15,7 @@ require_once dirname(__FILE__) . '/../../../view/iView.php'; require_once dirname(__FILE__) . '/../../../view/PHPView.php'; require_once dirname(__FILE__) . '/../../../view/helpers/ViewHelper.php'; require_once dirname(__FILE__) . '/../../../view/helpers/MsgViewHelper.php'; +require_once dirname(__FILE__) . '/../../../exception/InitializationException.php'; class MsgViewHelperTest extends PHPUnit_Framework_TestCase { @@ -29,15 +30,18 @@ class MsgViewHelperTest extends PHPUnit_Framework_TestCase public function testMsg() { + $this->helper->msg('new message from test', 'success'); $this->assertSame(array('message' => 'new message from test', 'type' => 'success'), Session::get('MsgViewHelper')); $this->assertSame($this->helper, $this->helper->msg('error message', 'error')); $this->assertSame(array('message' => 'error message', 'type' => 'error'), Session::get('MsgViewHelper')); + + } /** - * @expectedException Exception + * @expectedException InitializationException * @expectedExceptionMessage Unknown message type */ public function testWrongType() diff --git a/view/helpers/MsgViewHelper.php b/view/helpers/MsgViewHelper.php index afcc5a8..95f7128 100644 --- a/view/helpers/MsgViewHelper.php +++ b/view/helpers/MsgViewHelper.php @@ -21,7 +21,7 @@ class MsgViewHelper extends ViewHelper { if ($msg && $type) { if (!in_array($type, array(self::SUCCESS, self::ERROR))) { - throw new Exception('Unknown message type: "' . $type . '"'); + throw new InitializationException('Unknown message type: "' . $type . '"'); } Session::set(__CLASS__, array('message' => $msg, 'type' => $type)); }