You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.3 KiB

  1. <?php
  2. /*
  3. * @copyright NetMonsters <team@netmonsters.ru>
  4. * @link http://netmonsters.ru
  5. * @package Majestic
  6. * @subpackage UnitTests
  7. * @since 2011-10-11
  8. *
  9. * Unit tests for PHPView class
  10. */
  11. require_once dirname(__FILE__) . '/../../../Registry.php';
  12. require_once dirname(__FILE__) . '/../../../view/helpers/ViewHelper.php';
  13. require_once dirname(__FILE__) . '/../../../view/helpers/TitleViewHelper.php';
  14. class TitleViewHelperTest extends PHPUnit_Framework_TestCase
  15. {
  16. /**
  17. * @var TitleViewHelper
  18. */
  19. public $helper;
  20. public function setUp()
  21. {
  22. Registry::set('TitleViewHelper', array());
  23. $this->helper = new TitleViewHelper('view');
  24. }
  25. public function testTitle()
  26. {
  27. $this->helper->title('one');
  28. $result = Registry::get('TitleViewHelper');
  29. $this->assertSame(array('one'), Registry::get('TitleViewHelper'));
  30. $this->helper->title('two');
  31. $this->assertSame(array('one', 'two'), Registry::get('TitleViewHelper'));
  32. }
  33. public function testSeparator()
  34. {
  35. $this->helper->title('one');
  36. $this->helper->title('two');
  37. $this->assertSame('one - two', $this->helper->__toString());
  38. $this->helper->setSeparator('=');
  39. $this->assertSame('one=two', $this->helper->__toString());
  40. }
  41. }