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.

47 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-11-1
  8. *
  9. * Unit tests for StaticAction class
  10. */
  11. require_once dirname(__FILE__) . '/Action_TestCase.php';
  12. require_once dirname(__FILE__) . '/../../app/StaticAction.php';
  13. class StaticActionTest extends Action_TestCase
  14. {
  15. /**
  16. * @runInSeparateProcess
  17. */
  18. public function testFetchNoTemplate()
  19. {
  20. Config::set('DEBUG', false);
  21. Env::setParams(array('template' => ''));
  22. $controller = FrontController::getInstance();
  23. $controller->setView('SomeView');
  24. $action = $this->getMockForAbstractClass('StaticAction', array(), 'StaticActionMock');
  25. $result = $action->fetch();
  26. $this->assertSame('/static/StaticActi', $result['template']);
  27. }
  28. /**
  29. * @runInSeparateProcess
  30. */
  31. public function testFetchWithTemplate()
  32. {
  33. Config::set('DEBUG', false);
  34. Env::setParams(array('template' => 'SomeTemplate'));
  35. $controller = FrontController::getInstance();
  36. $controller->setView('SomeView');
  37. $action = $this->getMockForAbstractClass('StaticAction', array(), 'StaticActionMock');
  38. $result = $action->fetch();
  39. $this->assertSame('/static/SomeTemplate', $result['template']);
  40. }
  41. }