Example #1
0
 private static function findSubcommand($args)
 {
     $command = \Terminus::getRootCommand();
     while (!empty($args) && $command && $command->canHaveSubcommands()) {
         $command = $command->findSubcommand($args);
     }
     return $command;
 }
Example #2
0
 public function testGetRootCommand()
 {
     $root_command = Terminus::getRootCommand();
     $this->assertTrue(strpos(get_class($root_command), 'RootCommand') !== false);
     // Make sure the core commands have loaded
     $commands = array('art', 'auth', 'cli', 'drush', 'help', 'machine-tokens', 'organizations', 'site', 'sites', 'upstreams', 'workflows', 'wp');
     foreach ($commands as $command) {
         $args = array($command);
         $this->assertTrue($root_command->findSubcommand($args) !== false);
     }
     // Make sure the correct number of parameters are configured.
     $desc = $root_command->getLongdesc();
     $this->assertTrue(count($desc['parameters']) == 4);
 }
Example #3
0
 public function testGetPath()
 {
     $root_command = Terminus::getRootCommand();
     $path = Dispatcher\getPath($root_command);
     $this->assertEquals($path, ['terminus']);
 }
Example #4
0
File: cli.php Project: RobLoach/cli
 /**
  * Dump the list of installed commands, as JSON.
  *
  * @subcommand cmd-dump
  */
 function cmd_dump()
 {
     $this->output()->outputDump(self::command_to_array(Terminus::getRootCommand()));
 }
Example #5
0
 public function testGetRootCommand()
 {
     $root_command = Terminus::getRootCommand();
     $this->assertTrue(strpos(get_class($root_command), 'RootCommand') !== false);
 }