8000 [Console] command list ordering, styles in command names bugfix #12051 by spdionis · Pull Request #12500 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] command list ordering, styles in command names bugfix #12051 #12500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test for command ordering and raw output
  • Loading branch information
spdionis committed Mar 29, 2015
commit 823407a2c8db3b8bfa97dd49a77c81efa09e51ca
32 changes: 32 additions & 0 deletions src/Symfony/Component/Console/Tests/Command/ListCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,36 @@ public function testExecuteListsCommandsWithNamespaceArgument()

$this->assertEquals($output, $commandTester->getDisplay(true));
}

public function testExecuteListsCommandsNameAndNamespaceRaw()
{
require_once realpath(__DIR__.'/../Fixtures/Foo6Command.php');
$application = new Application();
$application->add(new \Foo6Command());
$commandTester = new CommandTester($command = $application->get('list'));
$commandTester->execute(array('command' => $command->getName()));
$output = <<<EOF
Console Tool

Usage:
[options] command [arguments]

Options:
--help (-h) Display this help message.
--quiet (-q) Do not output any message.
--verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
--version (-V) Display this application version.
--ansi Force ANSI output.
--no-ansi Disable ANSI output.
--no-interaction (-n) Do not ask any interactive question.

Available commands:
help Displays help for a command
list Lists commands
<fg=blue>foo
<fg=blue>foo:bar</fg=blue>
EOF;

$this->assertEquals($output, trim($commandTester->getDisplay(true)));
}
}
13 changes: 13 additions & 0 deletions src/Symfony/Component/Console/Tests/Fixtures/Foo6Command.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php


use Symfony\Component\Console\Command\Command;

class Foo6Command extends Command
{
protected function configure()
{
$this->setName('<fg=blue>foo:bar</fg=blue>');
}

}
0