public function test_registerCommandClasses_bad_classname() { $ci = new \stdClass(); $paths = [__DIR__ . '/Fake/user_commands_bad/']; UserConfig::registerCommandClasses($this->di, $ci, $paths); $stderr = $this->di->get('aura/cli-kernel:stdio')->getStderr(); $stderr->rewind(); $actual = $stderr->fread(); $expected = 'No such class: BadCommand'; $this->assertContains($expected, $actual); }
public function define(Container $di) { $di->set('aura/project-kernel:logger', $di->newInstance('Monolog\\Logger')); /* @var $ci \CI_Controller */ $ci =& get_instance(); // register built-in command classes foreach ($this->commands as $command) { $class = 'Kenjis\\CodeIgniter_Cli\\Command\\' . $command; $di->params[$class] = ['context' => $di->lazyGet('aura/cli-kernel:context'), 'stdio' => $di->lazyGet('aura/cli-kernel:stdio'), 'ci' => $ci]; } $seeder_path = APPPATH . 'database/seeds/'; $di->setter['Kenjis\\CodeIgniter_Cli\\Command\\Seed']['setSeederPath'] = $seeder_path; $this->user_command_paths = [APPPATH . 'commands/']; // register user command classes UserConfig::registerCommandClasses($di, $ci, $this->user_command_paths); }