/** * Tests to make sure we can parse for a basic command and task within an alternate namespace * * @return void **/ public function testParseBasicCommandAndTaskFromAlternateLocation() { $args = ['muse', 'alternative:subcommand']; Arguments::registerNamespace('Hubzero\\Console\\Tests\\Mock\\{$1}\\Cli\\Commands'); $arguments = new Arguments($args); $arguments->parse(); $this->assertEquals('Hubzero\\Console\\Tests\\Mock\\Alternative\\Cli\\Commands\\Subcommand', $arguments->get('class'), 'Arguments parser failed to find the proper command'); $this->assertEquals('execute', $arguments->get('task'), 'Arguments parser failed to find the proper task'); }
/** * Register the service provider * * @return void */ public function register() { $this->app['arguments'] = function ($app) { global $argv; // Register namespace for App commands and component commands // @FIXME: neither of these work yet... Arguments::registerNamespace('\\App\\Commands'); Arguments::registerNamespace('\\Components\\{$1}\\Cli\\Commands'); return new Arguments($argv); }; }