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.

69 lines
1.7 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. * Action_TestCase class for testing Actions
  10. */
  11. require_once dirname(__FILE__) . '/../../Registry.php';
  12. require_once dirname(__FILE__) . '/../../Config.php';
  13. require_once dirname(__FILE__) . '/../../Load.php';
  14. require_once dirname(__FILE__) . '/../../classes/Env.class.php';
  15. require_once dirname(__FILE__) . '/../../exception/ErrorHandler.php';
  16. require_once dirname(__FILE__) . '/../../app/FrontController.php';
  17. require_once dirname(__FILE__) . '/../../app/Action.php';
  18. require_once dirname(__FILE__) . '/../../view/iView.php';
  19. class Action_TestCase extends PHPUnit_Framework_TestCase
  20. {
  21. public function run(PHPUnit_Framework_TestResult $result = NULL)
  22. {
  23. $this->setPreserveGlobalState(false);
  24. return parent::run($result);
  25. }
  26. public function setUp()
  27. {
  28. $this->getMock('Router');
  29. $this->getMock('PHPView', array('fetch', 'assignObject'));
  30. }
  31. public function tearDown()
  32. {
  33. $env = new ReflectionClass('Env');
  34. $params = $env->getProperty('params');
  35. $params->setAccessible(true);
  36. $params->setValue('Env', array());
  37. }
  38. }
  39. class SomeView implements iView
  40. {
  41. private $result = array();
  42. public function fetch($template)
  43. {
  44. $this->result['template'] = $template;
  45. return $this->result;
  46. }
  47. public function assignObject() {}
  48. public function assign($name, $value = null) {
  49. $this->result[$name] = $value;
  50. }
  51. public function prepend($name, $value)
  52. {
  53. }
  54. public function append($name, $value)
  55. {
  56. }
  57. }