[Console] Add tests and support for more types of inputs
This commit is contained in:
parent
54c1377a33
commit
77c97913c8
|
@ -185,11 +185,11 @@ class Application
|
|||
if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
||||
} else {
|
||||
if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3')) {
|
||||
if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
|
||||
} elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2')) {
|
||||
} elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) {
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
|
||||
} elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose')) {
|
||||
} elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
|
||||
}
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ class Application
|
|||
|
||||
new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'),
|
||||
new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message.'),
|
||||
new InputOption('--verbose', '-v', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
|
||||
new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
|
||||
new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.'),
|
||||
new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output.'),
|
||||
new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output.'),
|
||||
|
|
|
@ -517,6 +517,12 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||
$tester->run(array('command' => 'list', '-v' => true));
|
||||
$this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed');
|
||||
|
||||
$tester->run(array('command' => 'list', '-vv' => true));
|
||||
$this->assertSame(Output::VERBOSITY_VERY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed');
|
||||
|
||||
$tester->run(array('command' => 'list', '-vvv' => true));
|
||||
$this->assertSame(Output::VERBOSITY_DEBUG, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed');
|
||||
|
||||
$application = new Application();
|
||||
$application->setAutoExit(false);
|
||||
$application->setCatchExceptions(false);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<comment>Options:</comment>
|
||||
<info>--help</info> <info>-h</info> Display this help message.
|
||||
<info>--quiet</info> <info>-q</info> Do not output any message.
|
||||
<info>--verbose</info> <info>-v</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
<info>--verbose</info> <info>-v|vv|vvv</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
<info>--version</info> <info>-V</info> Display this application version.
|
||||
<info>--ansi</info> Force ANSI output.
|
||||
<info>--no-ansi</info> Disable ANSI output.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<comment>Options:</comment>
|
||||
<info>--help</info> <info>-h</info> Display this help message.
|
||||
<info>--quiet</info> <info>-q</info> Do not output any message.
|
||||
<info>--verbose</info> <info>-v</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
<info>--verbose</info> <info>-v|vv|vvv</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
<info>--version</info> <info>-V</info> Display this application version.
|
||||
<info>--ansi</info> Force ANSI output.
|
||||
<info>--no-ansi</info> Disable ANSI output.
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<option name="--quiet" shortcut="-q" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
<description>Do not output any message.</description>
|
||||
</option>
|
||||
<option name="--verbose" shortcut="-v" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
<option name="--verbose" shortcut="-v" shortcuts="-v|-vv|-vvv" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
<description>Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</description>
|
||||
</option>
|
||||
<option name="--version" shortcut="-V" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
|
@ -109,7 +109,7 @@
|
|||
<option name="--quiet" shortcut="-q" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
<description>Do not output any message.</description>
|
||||
</option>
|
||||
<option name="--verbose" shortcut="-v" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
<option name="--verbose" shortcut="-v" shortcuts="-v|-vv|-vvv" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
<description>Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</description>
|
||||
</option>
|
||||
<option name="--version" shortcut="-V" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<option name="--quiet" shortcut="-q" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
<description>Do not output any message.</description>
|
||||
</option>
|
||||
<option name="--verbose" shortcut="-v" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
<option name="--verbose" shortcut="-v" shortcuts="-v|-vv|-vvv" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
<description>Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</description>
|
||||
</option>
|
||||
<option name="--version" shortcut="-V" accept_value="0" is_value_required="0" is_multiple="0">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<comment>Options:</comment>
|
||||
<info>--help</info> <info>-h</info> Display this help message.
|
||||
<info>--quiet</info> <info>-q</info> Do not output any message.
|
||||
<info>--verbose</info> <info>-v</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
<info>--verbose</info> <info>-v|vv|vvv</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
<info>--version</info> <info>-V</info> Display this application version.
|
||||
<info>--ansi</info> Force ANSI output.
|
||||
<info>--no-ansi</info> Disable ANSI output.
|
||||
|
|
|
@ -6,7 +6,7 @@ Usage:
|
|||
Options:
|
||||
--help -h Display this help message.
|
||||
--quiet -q Do not output any message.
|
||||
--verbose -v Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
--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.
|
||||
|
|
|
@ -11,7 +11,7 @@ Options:
|
|||
--raw To output raw command help
|
||||
--help (-h) Display this help message.
|
||||
--quiet (-q) Do not output any message.
|
||||
--verbose (-v) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
--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.
|
||||
|
|
Reference in New Issue