diff --git a/tests/app/CliControllerTest.php b/tests/app/CliControllerTest.php new file mode 100644 index 0000000..da4ff64 --- /dev/null +++ b/tests/app/CliControllerTest.php @@ -0,0 +1,50 @@ + + * @link http://netmonsters.ru + * @package Majestic + * @subpackage Tests app + * @since 10.07.12 + * + */ + +require_once __DIR__ . '/../../util/profiler/Profiler.php'; +require_once __DIR__ . '/../../exception/GeneralException.php'; +require_once __DIR__ . '/../../exception/Error404Exception.php'; +require_once __DIR__ . '/../../exception/ErrorHandler.php'; +require_once __DIR__ . '/../../app/CliController.php'; +require_once __DIR__ . '/../../Registry.php'; +require_once __DIR__ . '/../../Config.php'; +require_once __DIR__ . '/../../app/iCli.php'; + +/** + * @desc CliController tests + * @author Aleksandr Demidov + */ +class CliControllerTest extends PHPUnit_Framework_TestCase +{ + public function _testGetInstance() + { + $instance = CliController::getInstance(); + $this->assertInstanceOf('CliController', $instance); + } + + public function _testExecute() + { + $cli_class = $this->getMockForAbstractClass('iCli', array(), '', '', '', '', array('run')); + $cli_class->expects($this->once()) + ->method('run') + ->with(); + CliController::getInstance()->execute($cli_class); + } + + /** + * @runInSeparateProcess + */ + public function testExecuteImplementError() + { + $cli_class = new StdClass(); + $this->setExpectedException('ErrorException', 'Runner "' . get_class($cli_class) . '" need implement of "iCli" interface.'); + CliController::getInstance()->execute($cli_class); + } +} \ No newline at end of file