replacement Exception() on InitializationException()
This commit is contained in:
@ -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()
|
||||
|
@ -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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user