markDefault() public method

The names of default commands can be omitted when calling the command. For example, the following command can be called in two ways: php protected function configure() { $this ->beginCommand('add') ->markDefault() ->addArgument('host', Argument::REQUIRED) ->end() ... ; } The first way is to call the command regularly. The second way is to omit the name of the command: php $ ./console add localhost $ ./console localhost
public markDefault ( ) : static
return static The current instance.
Esempio n. 1
0
 public function testMarkDefault()
 {
     $this->assertFalse($this->config->isDefault());
     $this->assertFalse($this->config->isAnonymous());
     $this->config->markDefault();
     $this->assertTrue($this->config->isDefault());
     $this->assertFalse($this->config->isAnonymous());
 }
 public function testHasDefaultCommands()
 {
     $config = new CommandConfig('command');
     $config->markDefault();
     $this->config->addCommandConfig($config);
     $application = new ConsoleApplication($this->config);
     $this->assertTrue($application->hasDefaultCommands());
 }