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.5 KiB

  1. <?php
  2. /**
  3. * @copyright NetMonsters <team@netmonsters.ru>
  4. * @link http://netmonsters.ru
  5. * @package Majestic
  6. * @subpackage Tests app
  7. * @since 10.07.12
  8. *
  9. */
  10. require_once __DIR__ . '/../../util/profiler/Profiler.php';
  11. require_once __DIR__ . '/../../exception/GeneralException.php';
  12. require_once __DIR__ . '/../../exception/Error404Exception.php';
  13. require_once __DIR__ . '/../../exception/ErrorHandler.php';
  14. require_once __DIR__ . '/../../app/CliController.php';
  15. require_once __DIR__ . '/../../Registry.php';
  16. require_once __DIR__ . '/../../Config.php';
  17. require_once __DIR__ . '/../../app/iCli.php';
  18. /**
  19. * @desc CliController tests
  20. * @author Aleksandr Demidov
  21. */
  22. class CliControllerTest extends PHPUnit_Framework_TestCase
  23. {
  24. public function _testGetInstance()
  25. {
  26. $instance = CliController::getInstance();
  27. $this->assertInstanceOf('CliController', $instance);
  28. }
  29. public function _testExecute()
  30. {
  31. $cli_class = $this->getMockForAbstractClass('iCli', array(), '', '', '', '', array('run'));
  32. $cli_class->expects($this->once())
  33. ->method('run')
  34. ->with();
  35. CliController::getInstance()->execute($cli_class);
  36. }
  37. /**
  38. * @runInSeparateProcess
  39. */
  40. public function testExecuteImplementError()
  41. {
  42. $cli_class = new StdClass();
  43. $this->setExpectedException('ErrorException', 'Runner "' . get_class($cli_class) . '" need implement of "iCli" interface.');
  44. CliController::getInstance()->execute($cli_class);
  45. }
  46. }