Added new message types: info, warning to MgsViewHelper. Added method withPrefix to add custom css prefix to message
This commit is contained in:
@ -58,7 +58,21 @@ class MsgViewHelperTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertSame(array('message' => 'error message', 'type' => 'error'), Session::get('MsgViewHelper'));
|
||||
$this->assertNull(Session::get('test'));
|
||||
}
|
||||
|
||||
|
||||
public function testInfo()
|
||||
{
|
||||
$this->helper->info('info message');
|
||||
$this->assertSame(array('message' => 'info message', 'type' => 'info'), Session::get('MsgViewHelper'));
|
||||
$this->assertNull(Session::get('test'));
|
||||
}
|
||||
|
||||
public function testWarning()
|
||||
{
|
||||
$this->helper->warning('warning message');
|
||||
$this->assertSame(array('message' => 'warning message', 'type' => 'warning'), Session::get('MsgViewHelper'));
|
||||
$this->assertNull(Session::get('test'));
|
||||
}
|
||||
|
||||
public function testToString()
|
||||
{
|
||||
$this->helper->success('yeah');
|
||||
@ -71,4 +85,17 @@ class MsgViewHelperTest extends PHPUnit_Framework_TestCase
|
||||
$result = $this->helper->__toString();
|
||||
$this->assertEmpty($result);
|
||||
}
|
||||
|
||||
public function testToStringWithPrefix()
|
||||
{
|
||||
$this->helper->success('yeah');
|
||||
$result = $this->helper->withPrefix('prefix')->__toString();
|
||||
$this->assertSame('<div class="prefixsuccess">yeah</div>', $result);
|
||||
}
|
||||
|
||||
public function testToStringEmptyWithPrefix()
|
||||
{
|
||||
$result = $this->helper->withPrefix('prefix')->__toString();
|
||||
$this->assertEmpty($result);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user