Browse Source

Code formatting for ViewHelper & tests

master
Anton Terekhov 12 years ago
parent
commit
07a244ca35
  1. 6
      tests/view/helpers/BreadcrumbVeiwHelperTest.php
  2. 4
      tests/view/helpers/GetViewHelperTest.php
  3. 3
      tests/view/helpers/HeadViewHelperTest.php
  4. 7
      tests/view/helpers/MsgViewHelperTest.php
  5. 4
      tests/view/helpers/TitleViewHelperTest.php
  6. 2
      view/helpers/GetViewHelper.php

6
tests/view/helpers/BreadcrumbVeiwHelperTest.php

@ -17,6 +17,9 @@ require_once dirname(__FILE__) . '/../../../view/helpers/BreadcrumbViewHelper.ph
class BreadcrumbViewHelperTest extends PHPUnit_Framework_TestCase
{
/**
* @var BreadcrumbViewHelper
*/
public $helper;
public function setUp()
@ -43,7 +46,7 @@ class BreadcrumbViewHelperTest extends PHPUnit_Framework_TestCase
$this->helper->prepend('Home page', 'home.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('<a href="home.php">Home page</a> &gt; <a href="guest.php">Guest page</a> &gt; <a href="feedback.php">Leave message</a>', $result);
@ -55,6 +58,5 @@ class BreadcrumbViewHelperTest extends PHPUnit_Framework_TestCase
$this->helper->append('Last page', '');
$result = $this->helper->__toString();
$this->assertSame('<a href="home.php">Home page</a>-<a href="guest.php">Guest page</a>-<a href="feedback.php">Leave message</a>-Last page', $result);
}
}

4
tests/view/helpers/GetViewHelperTest.php

@ -19,6 +19,9 @@ require_once dirname(__FILE__) . '/../../../view/helpers/GetViewHelper.php';
class GetViewHelperTest extends PHPUnit_Framework_TestCase
{
/**
* @var GetViewHelper
*/
public $helper;
public function setUp()
@ -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&amp;a[two]=2&amp;b=c+d+e&amp;c[five]=six+seven', $result);
}
}

3
tests/view/helpers/HeadViewHelperTest.php

@ -17,6 +17,9 @@ require_once dirname(__FILE__) . '/../../../view/helpers/HeadViewHelper.php';
class HeadViewHelperTest extends PHPUnit_Framework_TestCase
{
/**
* @var HeadViewHelper
*/
public $helper;
public function setUp()

7
tests/view/helpers/MsgViewHelperTest.php

@ -19,7 +19,9 @@ require_once dirname(__FILE__) . '/../../../exception/GeneralException.php';
class MsgViewHelperTest extends PHPUnit_Framework_TestCase
{
/**
* @var MsgViewHelper
*/
public $helper;
public function setUp()
@ -36,8 +38,6 @@ class MsgViewHelperTest extends PHPUnit_Framework_TestCase
$this->assertSame($this->helper, $this->helper->msg('error message', 'error'));
$this->assertSame(array('message' => 'error message', 'type' => 'error'), Session::get('MsgViewHelper'));
}
public function testWrongType()
@ -71,5 +71,4 @@ class MsgViewHelperTest extends PHPUnit_Framework_TestCase
$result = $this->helper->__toString();
$this->assertEmpty($result);
}
}

4
tests/view/helpers/TitleViewHelperTest.php

@ -16,7 +16,9 @@ require_once dirname(__FILE__) . '/../../../view/helpers/TitleViewHelper.php';
class TitleViewHelperTest extends PHPUnit_Framework_TestCase
{
/**
* @var TitleViewHelper
*/
public $helper;
public function setUp()

2
view/helpers/GetViewHelper.php

@ -43,7 +43,7 @@ class GetViewHelper extends ViewHelper
protected function impl($name, $value)
{
if (is_array($value)){
if (is_array($value)) {
$result = array();
foreach ($value as $key => $val) {
$result[] = $name . '[' . $key . ']=' . urlencode($val);

Loading…
Cancel
Save