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.4 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. if(!defined('DEBUG')) {
  21. define('DEBUG', false);
  22. }
  23. Env::setParams(array('template' => ''));
  24. $controller = FrontController::getInstance();
  25. $controller->setView('SomeView');
  26. $action = $this->getMockForAbstractClass('StaticAction', array(), 'StaticActionMock');
  27. $result = $action->fetch();
  28. $this->assertSame('/static/StaticActi', $result['template']);
  29. }
  30. /**
  31. * @runInSeparateProcess
  32. */
  33. public function testFetchWithTemplate()
  34. {
  35. if(!defined('DEBUG')) {
  36. define('DEBUG', false);
  37. }
  38. Env::setParams(array('template' => 'SomeTemplate'));
  39. $controller = FrontController::getInstance();
  40. $controller->setView('SomeView');
  41. $action = $this->getMockForAbstractClass('StaticAction', array(), 'StaticActionMock');
  42. $result = $action->fetch();
  43. $this->assertSame('/static/SomeTemplate', $result['template']);
  44. }
  45. }