示例#1
0
 /**
  * Sets the name of the command.
  *
  * Contrary to the base implementation, the name of an option command must
  * contain at least two characters.
  *
  * @param string $name The name of the command.
  *
  * @return static The current instance.
  */
 public function setName($name)
 {
     if (null !== $name) {
         Assert::string($name, 'The command name must be a string or null. Got: %s');
         Assert::notEmpty($name, 'The command name must not be empty.');
         Assert::greaterThan(strlen($name), 1, sprintf('The command name should contain at least two characters. Got: "%s"', $name));
     }
     parent::setName($name);
     return $this;
 }
示例#2
0
 public function testHasSubCommandConfig()
 {
     $this->config->addSubCommandConfig($config = new SubCommandConfig());
     $this->assertFalse($this->config->hasSubCommandConfig('command'));
     $this->assertFalse($this->config->hasSubCommandConfig('foobar'));
     $config->setName('command');
     $this->assertTrue($this->config->hasSubCommandConfig('command'));
     $this->assertFalse($this->config->hasSubCommandConfig('foobar'));
 }