/** * @param Command $command * * @return string */ public function generate(Command $command) { $origMethodName = $command->getMethod() ?: $command->getName(); $methodNameParts = explode('-', $origMethodName); $methodNameStart = array_shift($methodNameParts); $methodNameEnd = implode('', array_map('ucfirst', $methodNameParts)); return $methodNameStart . $methodNameEnd . 'Cmd'; }
public function testCommand() { $cmd = new Command('cmd', 'description', ['cmd1', 'cmd2'], true, 'cmdMethod'); $this->assertSame('cmd', $cmd->getName()); $this->assertSame('description', $cmd->getDescription()); $this->assertSame(['cmd1', 'cmd2'], $cmd->getAliases()); $this->assertTrue($cmd->isDefault()); $this->assertSame('cmdMethod', $cmd->getMethod()); }