use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\HelpCommand;
use Symfony\Component\Console\Command\ListCommand;
use Symfony\Component\Console\Tester\CommandCompletionTester;
use Symfony\Component\Console\Tester\CommandTester;
class HelpCommandTest extends TestCase
{ public function testExecuteForCommandAlias() { $command =
new HelpCommand();
$command->
setApplication(new Application());
$commandTester =
new CommandTester($command);
$commandTester->
execute(['command_name' => 'li'
],
['decorated' => false
]);
$this->
assertStringContainsString('list [options] [--] [<namespace>]',
$commandTester->
getDisplay(), '->execute() returns a text help for the given command alias'
);
$this->
assertStringContainsString('format=FORMAT',
$commandTester->
getDisplay(), '->execute() returns a text help for the given command alias'
);
$this->
assertStringContainsString('raw',
$commandTester->
getDisplay(), '->execute() returns a text help for the given command alias'
);
} public function testExecuteForCommand() { $command =
new HelpCommand();