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

50 lines
1.3 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/TitleViewHelper.php';
class TitleViewHelperTest extends PHPUnit_Framework_TestCase
{
2012-11-21 15:43:20 +04:00
/**
* @var TitleViewHelper
*/
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('TitleViewHelper', array());
$this->helper = new TitleViewHelper('view');
}
2012-11-21 15:43:20 +04:00
2011-10-13 18:25:04 +04:00
public function testTitle()
{
2012-11-21 15:43:20 +04:00
$this->helper->title('one');
2011-10-13 18:25:04 +04:00
$result = Registry::get('TitleViewHelper');
$this->assertSame(array('one'), Registry::get('TitleViewHelper'));
2012-11-21 15:43:20 +04:00
$this->helper->title('two');
2011-10-13 18:25:04 +04:00
$this->assertSame(array('one', 'two'), Registry::get('TitleViewHelper'));
}
2012-11-21 15:43:20 +04:00
2011-10-13 18:25:04 +04:00
public function testSeparator()
{
2012-11-21 15:43:20 +04:00
$this->helper->title('one');
$this->helper->title('two');
2011-10-13 18:25:04 +04:00
$this->assertSame('one - two', $this->helper->__toString());
$this->helper->setSeparator('=');
2012-11-21 15:43:20 +04:00
$this->assertSame('one=two', $this->helper->__toString());
2011-10-13 18:25:04 +04:00
}
}