Code formatting for ViewHelper & tests
This commit is contained in:
@ -19,25 +19,25 @@ require_once dirname(__FILE__) . '/../../../exception/GeneralException.php';
|
||||
|
||||
class MsgViewHelperTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var MsgViewHelper
|
||||
*/
|
||||
public $helper;
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
Session::del('MsgViewHelper');
|
||||
$this->helper = new MsgViewHelper(new PHPView(array('path' => 'any')));
|
||||
}
|
||||
|
||||
|
||||
public function testMsg()
|
||||
{
|
||||
|
||||
$this->helper->msg('new message from test', 'success');
|
||||
$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'));
|
||||
|
||||
|
||||
$this->assertSame($this->helper, $this->helper->msg('error message', 'error'));
|
||||
$this->assertSame(array('message' => 'error message', 'type' => 'error'), Session::get('MsgViewHelper'));
|
||||
}
|
||||
|
||||
public function testWrongType()
|
||||
@ -45,13 +45,13 @@ class MsgViewHelperTest extends PHPUnit_Framework_TestCase
|
||||
$this->setExpectedException('GeneralException', 'Unknown message type');
|
||||
$this->helper->msg('some message', 'wrong');
|
||||
}
|
||||
|
||||
|
||||
public function testSuccess()
|
||||
{
|
||||
$this->helper->success('success message');
|
||||
$this->assertSame(array('message' => 'success message', 'type' => 'success'), Session::get('MsgViewHelper'));
|
||||
}
|
||||
|
||||
|
||||
public function testError()
|
||||
{
|
||||
$this->helper->error('error message');
|
||||
@ -65,11 +65,10 @@ class MsgViewHelperTest extends PHPUnit_Framework_TestCase
|
||||
$result = $this->helper->__toString();
|
||||
$this->assertSame('<div class="success">yeah</div>', $result);
|
||||
}
|
||||
|
||||
|
||||
public function testToStringEmpty()
|
||||
{
|
||||
$result = $this->helper->__toString();
|
||||
$this->assertEmpty($result);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user