diff --git a/tests/view/helpers/BreadcrumbVeiwHelperTest.php b/tests/view/helpers/BreadcrumbVeiwHelperTest.php index db4351b..d490280 100644 --- a/tests/view/helpers/BreadcrumbVeiwHelperTest.php +++ b/tests/view/helpers/BreadcrumbVeiwHelperTest.php @@ -16,45 +16,47 @@ require_once dirname(__FILE__) . '/../../../view/helpers/BreadcrumbViewHelper.ph class BreadcrumbViewHelperTest extends PHPUnit_Framework_TestCase { - + + /** + * @var BreadcrumbViewHelper + */ public $helper; - + public function setUp() { Registry::set('BreadcrumbViewHelper', array()); $this->helper = new BreadcrumbViewHelper(new PHPView('any')); } - + public function testTitle() { - $this->helper->breadcrumb('Guest page', 'guest.php'); + $this->helper->breadcrumb('Guest page', 'guest.php'); $result = Registry::get('BreadcrumbViewHelper'); - $this->assertSame(array('Guest page' => 'guest.php'), Registry::get('BreadcrumbViewHelper')); - + $this->assertSame(array('Guest page' => 'guest.php'), Registry::get('BreadcrumbViewHelper')); + $this->helper->prepend('Leave message', 'feedback.php'); - $this->assertSame(array('Leave message' => 'feedback.php', 'Guest page' => 'guest.php'), Registry::get('BreadcrumbViewHelper')); - + $this->assertSame(array('Leave message' => 'feedback.php', 'Guest page' => 'guest.php'), Registry::get('BreadcrumbViewHelper')); + $this->helper->append('Home page', 'home.php'); - $this->assertSame(array('Leave message' => 'feedback.php', 'Guest page' => 'guest.php', 'Home page' => 'home.php'), Registry::get('BreadcrumbViewHelper')); + $this->assertSame(array('Leave message' => 'feedback.php', 'Guest page' => 'guest.php', 'Home page' => 'home.php'), Registry::get('BreadcrumbViewHelper')); } - + public function testToString() { $this->helper->prepend('Home page', 'home.php'); - $this->helper->breadcrumb('Guest page', 'guest.php'); + $this->helper->breadcrumb('Guest page', 'guest.php'); $this->helper->append('Leave message', 'feedback.php'); - $this->assertSame(array('Home page' => 'home.php', 'Guest page' => 'guest.php', 'Leave message'=> 'feedback.php'), Registry::get('BreadcrumbViewHelper')); - + $this->assertSame(array('Home page' => 'home.php', 'Guest page' => 'guest.php', 'Leave message' => 'feedback.php'), Registry::get('BreadcrumbViewHelper')); + $result = $this->helper->__toString(); $this->assertSame('Home page > Guest page > Leave message', $result); - + $this->helper->setSeparator('-'); $result = $this->helper->__toString(); $this->assertSame('Home page-Guest page-Leave message', $result); - + $this->helper->append('Last page', ''); $result = $this->helper->__toString(); $this->assertSame('Home page-Guest page-Leave message-Last page', $result); - } } diff --git a/tests/view/helpers/GetViewHelperTest.php b/tests/view/helpers/GetViewHelperTest.php index dac3f28..5449c74 100644 --- a/tests/view/helpers/GetViewHelperTest.php +++ b/tests/view/helpers/GetViewHelperTest.php @@ -18,14 +18,17 @@ require_once dirname(__FILE__) . '/../../../view/helpers/GetViewHelper.php'; class GetViewHelperTest extends PHPUnit_Framework_TestCase { - + + /** + * @var GetViewHelper + */ public $helper; - + public function setUp() { $this->helper = new GetViewHelper(new PHPView('any')); } - + /** * @TODO: GetViewHelper: initialize GetViewHelper::$get with empty array() */ @@ -34,7 +37,7 @@ class GetViewHelperTest extends PHPUnit_Framework_TestCase $this->setExpectedException('PHPUnit_Framework_Error'); $this->helper->get(null); } - + /** * @TODO: GetViewHelper: check $_GET not null */ @@ -43,7 +46,7 @@ class GetViewHelperTest extends PHPUnit_Framework_TestCase $this->setExpectedException('PHPUnit_Framework_Error'); $result = $this->helper->get('param'); } - + public function testGetWithSingleParam() { $_GET['a'] = 'b'; @@ -59,7 +62,7 @@ class GetViewHelperTest extends PHPUnit_Framework_TestCase $result = $this->helper->get(array('a')); $this->assertSame('?b=a', $result); } - + public function testGetWithArray() { $_GET['a'] = array('one' => 1, 'two' => 2); @@ -77,5 +80,4 @@ class GetViewHelperTest extends PHPUnit_Framework_TestCase $result = $this->helper->get(array('b' => 'c d e', 'c' => array('five' => 'six seven'))); $this->assertSame('?a[one]=1&a[two]=2&b=c+d+e&c[five]=six+seven', $result); } - } diff --git a/tests/view/helpers/HeadViewHelperTest.php b/tests/view/helpers/HeadViewHelperTest.php index e75e52a..6887af9 100644 --- a/tests/view/helpers/HeadViewHelperTest.php +++ b/tests/view/helpers/HeadViewHelperTest.php @@ -16,32 +16,35 @@ require_once dirname(__FILE__) . '/../../../view/helpers/HeadViewHelper.php'; class HeadViewHelperTest extends PHPUnit_Framework_TestCase { - + + /** + * @var HeadViewHelper + */ public $helper; - + public function setUp() { Registry::set('HeadViewHelper', array()); $this->helper = new HeadViewHelper(null); } - + public function testHead() { - $this->helper->head(''); + $this->helper->head(''); $result = Registry::get('HeadViewHelper'); $this->assertSame(array(''), Registry::get('HeadViewHelper')); - - $this->helper->head(''); + + $this->helper->head(''); $this->assertSame(array('', ''), Registry::get('HeadViewHelper')); } - + public function testToString() { - $this->helper->head(''); - $this->helper->head(''); - + $this->helper->head(''); + $this->helper->head(''); + $result = $this->helper->__toString(); - + $this->assertSame("\n \n", $result); } } diff --git a/tests/view/helpers/MsgViewHelperTest.php b/tests/view/helpers/MsgViewHelperTest.php index 1c83619..d9405e9 100644 --- a/tests/view/helpers/MsgViewHelperTest.php +++ b/tests/view/helpers/MsgViewHelperTest.php @@ -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('