$ret = $command->setHelp('help1'); $t->is($ret, $command, '->setHelp() implements a fluent interface'); $t->is($command->getHelp(), 'help1', '->setHelp() sets the help'); // ->getAliases() ->setAliases() $t->diag('->getAliases() ->setAliases()'); $t->is($command->getAliases(), array('name'), '->getAliases() returns the aliases'); $ret = $command->setAliases(array('name1')); $t->is($ret, $command, '->setAliases() implements a fluent interface'); $t->is($command->getAliases(), array('name1'), '->setAliases() sets the aliases'); // ->getSynopsis() $t->diag('->getSynopsis()'); $t->is($command->getSynopsis(), '%s foobar:bar [--foo] [foo]', '->getSynopsis() returns the synopsis'); // ->mergeApplicationDefinition() $t->diag('->mergeApplicationDefinition()'); $application1 = new Application(); $application1->getDefinition()->addArguments(array(new Argument('foo'))); $application1->getDefinition()->addOptions(array(new Option('bar'))); $command = new TestCommand(); $command->setApplication($application1); $command->setDefinition($definition = new Definition(array(new Argument('bar'), new Option('foo')))); $command->mergeApplicationDefinition(); $t->ok($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); $t->ok($command->getDefinition()->hasArgument('bar'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); $t->ok($command->getDefinition()->hasOption('foo'), '->mergeApplicationDefinition() merges the application options and the command options'); $t->ok($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition() merges the application options and the command options'); $command->mergeApplicationDefinition(); $t->is($command->getDefinition()->getArgumentCount(), 3, '->mergeApplicationDefinition() does not try to merge twice the application arguments and options'); $command = new TestCommand(); $command->mergeApplicationDefinition(); $t->pass('->mergeApplicationDefinition() does nothing if application is not set'); // ->run()