Files
majestic/tests/view/helpers/HeadViewHelperTest.php

51 lines
1.2 KiB
PHP
Raw Normal View History

2011-10-13 18:25:04 +04:00
<?php
/*
* @copyright NetMonsters <team@netmonsters.ru>
* @link http://netmonsters.ru
* @package Majestic
* @subpackage UnitTests
* @since 2011-10-11
*
* Unit tests for PHPView class
*/
require_once dirname(__FILE__) . '/../../../Registry.php';
require_once dirname(__FILE__) . '/../../../view/helpers/ViewHelper.php';
require_once dirname(__FILE__) . '/../../../view/helpers/HeadViewHelper.php';
class HeadViewHelperTest extends PHPUnit_Framework_TestCase
{
2012-11-21 15:43:20 +04:00
/**
* @var HeadViewHelper
*/
2011-10-13 18:25:04 +04:00
public $helper;
2012-11-21 15:43:20 +04:00
2011-10-13 18:25:04 +04:00
public function setUp()
{
Registry::set('HeadViewHelper', array());
$this->helper = new HeadViewHelper(null);
}
2012-11-21 15:43:20 +04:00
2011-10-13 18:25:04 +04:00
public function testHead()
{
2012-11-21 15:43:20 +04:00
$this->helper->head('<meta />');
2011-10-13 18:25:04 +04:00
$result = Registry::get('HeadViewHelper');
$this->assertSame(array('<meta />'), Registry::get('HeadViewHelper'));
2012-11-21 15:43:20 +04:00
$this->helper->head('<link />');
2011-10-13 18:25:04 +04:00
$this->assertSame(array('<meta />', '<link />'), Registry::get('HeadViewHelper'));
}
2012-11-21 15:43:20 +04:00
2011-10-13 18:25:04 +04:00
public function testToString()
{
2012-11-21 15:43:20 +04:00
$this->helper->head('<meta />');
$this->helper->head('<link />');
2011-10-13 18:25:04 +04:00
$result = $this->helper->__toString();
2012-11-21 15:43:20 +04:00
2011-10-13 18:25:04 +04:00
$this->assertSame("<meta />\n <link />\n", $result);
}
}