public function testRegisterCustomCommand() { \Codeception\Configuration::append(array('extensions' => array('commands' => array('Codeception\\Command\\MyCustomCommand')))); $application = new Application(); $application->registerCustomCommands(); try { $application->find('myProject:myCommand'); } catch (\Exception $e) { $this->fail($e->getMessage()); } }
protected function execute($args = [], $isSuite = true) { $app = new Application(); $app->add($this->command); $default = \Codeception\Configuration::$defaultConfig; $default['paths']['tests'] = __DIR__; $conf = $isSuite ? \Codeception\Configuration::suiteSettings('unit', $default) : $default; $this->config = array_merge($conf, $this->config); $commandTester = new CommandTester($app->find($this->commandName)); $args['command'] = $this->commandName; $commandTester->execute($args, ['interactive' => false]); $this->output = $commandTester->getDisplay(); }