[bugfix] [Console] Set Input::$interactive
to false
when command is executed with --quiet
as verbosity level
This commit is contained in:
parent
2a9be06bc8
commit
4214311a1c
@ -337,7 +337,7 @@ class Application
|
|||||||
* Adds an array of command objects.
|
* Adds an array of command objects.
|
||||||
*
|
*
|
||||||
* If a Command is not enabled it will not be added.
|
* If a Command is not enabled it will not be added.
|
||||||
*
|
*
|
||||||
* @param Command[] $commands An array of commands
|
* @param Command[] $commands An array of commands
|
||||||
*/
|
*/
|
||||||
public function addCommands(array $commands)
|
public function addCommands(array $commands)
|
||||||
@ -808,6 +808,7 @@ class Application
|
|||||||
|
|
||||||
if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
|
if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
|
||||||
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
||||||
|
$input->setInteractive(false);
|
||||||
} else {
|
} else {
|
||||||
if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
|
if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
|
||||||
$output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
|
$output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
|
||||||
|
@ -636,9 +636,11 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$tester->run(array('command' => 'list', '--quiet' => true));
|
$tester->run(array('command' => 'list', '--quiet' => true));
|
||||||
$this->assertSame('', $tester->getDisplay(), '->run() removes all output if --quiet is passed');
|
$this->assertSame('', $tester->getDisplay(), '->run() removes all output if --quiet is passed');
|
||||||
|
$this->assertFalse($tester->getInput()->isInteractive(), '->run() sets off the interactive mode if --quiet is passed');
|
||||||
|
|
||||||
$tester->run(array('command' => 'list', '-q' => true));
|
$tester->run(array('command' => 'list', '-q' => true));
|
||||||
$this->assertSame('', $tester->getDisplay(), '->run() removes all output if -q is passed');
|
$this->assertSame('', $tester->getDisplay(), '->run() removes all output if -q is passed');
|
||||||
|
$this->assertFalse($tester->getInput()->isInteractive(), '->run() sets off the interactive mode if -q is passed');
|
||||||
|
|
||||||
$tester->run(array('command' => 'list', '--verbose' => true));
|
$tester->run(array('command' => 'list', '--verbose' => true));
|
||||||
$this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if --verbose is passed');
|
$this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if --verbose is passed');
|
||||||
|
Reference in New Issue
Block a user