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.

50 lines
1.5 KiB

<?php
/**
* @copyright NetMonsters <team@netmonsters.ru>
* @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);
}
}