[Console] Add namespace support back in to list command
This commit is contained in:
parent
55f2000580
commit
79a842a83d
@ -73,7 +73,7 @@ EOF
|
||||
}
|
||||
|
||||
$helper = new DescriptorHelper();
|
||||
$helper->describe($output, $this->getApplication(), $input->getOption('format'), $input->getOption('raw'));
|
||||
$helper->describe($output, $this->getApplication(), $input->getOption('format'), $input->getOption('raw'), $input->getArgument('namespace'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,9 +56,9 @@ class DescriptorHelper extends Helper
|
||||
* @param string $format
|
||||
* @param boolean $raw
|
||||
*/
|
||||
public function describe(OutputInterface $output, $object, $format = null, $raw = false)
|
||||
public function describe(OutputInterface $output, $object, $format = null, $raw = false, $namespace = null)
|
||||
{
|
||||
$options = array('raw_text' => $raw, 'format' => $format ?: 'txt');
|
||||
$options = array('raw_text' => $raw, 'format' => $format ?: 'txt', 'namespace' => $namespace);
|
||||
$type = !$raw && 'txt' === $options['format'] ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW;
|
||||
|
||||
if (!isset($this->descriptors[$options['format']])) {
|
||||
|
@ -42,6 +42,22 @@ class ListCommandTest extends \PHPUnit_Framework_TestCase
|
||||
help Displays help for a command
|
||||
list Lists commands
|
||||
|
||||
EOF;
|
||||
|
||||
$this->assertEquals($output, $commandTester->getDisplay(true));
|
||||
}
|
||||
|
||||
public function testExecuteListsCommandsWithNamespaceArgument()
|
||||
{
|
||||
|
||||
require_once(realpath(__DIR__.'/../Fixtures/FooCommand.php'));
|
||||
$application = new Application();
|
||||
$application->add(new \FooCommand());
|
||||
$commandTester = new CommandTester($command = $application->get('list'));
|
||||
$commandTester->execute(array('command' => $command->getName(), 'namespace' => 'foo', '--raw' => true));
|
||||
$output = <<<EOF
|
||||
foo:bar The foo:bar command
|
||||
|
||||
EOF;
|
||||
|
||||
$this->assertEquals($output, $commandTester->getDisplay(true));
|
||||
|
Reference in New Issue
Block a user