From 5bb41636bcb56a622426b2be790d8a352b5f2e81 Mon Sep 17 00:00:00 2001 From: Florin Patan Date: Thu, 11 Apr 2013 22:38:29 +0300 Subject: [PATCH] Fixed tests --- src/Symfony/Component/Console/Application.php | 12 +++++++----- .../Component/Console/Tests/ApplicationTest.php | 6 +++--- .../Console/Tests/Fixtures/application_astext1.txt | 2 +- .../Console/Tests/Fixtures/application_astext2.txt | 2 +- .../Console/Tests/Fixtures/application_asxml1.txt | 14 ++++---------- .../Console/Tests/Fixtures/application_asxml2.txt | 7 ++----- .../Console/Tests/Fixtures/application_gethelp.txt | 2 +- .../Console/Tests/Fixtures/application_run1.txt | 2 +- .../Console/Tests/Fixtures/application_run2.txt | 2 +- .../Console/Tests/Fixtures/command_astext.txt | 2 +- .../Console/Tests/Fixtures/command_asxml.txt | 7 ++----- 11 files changed, 24 insertions(+), 34 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 7b437f1986..63d5dea102 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -184,14 +184,16 @@ class Application if (true === $input->hasParameterOption(array('--quiet', '-q'))) { $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); - } else { - if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3')) { + } elseif($input->hasParameterOption('--verbose')) { + if ($input->hasParameterOption('-vvv') || $input->getParameterOption('--verbose') === 3) { $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); - } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2')) { + } elseif ($input->hasParameterOption('-vv') || $input->getParameterOption('--verbose') === 2) { $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); - } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose')) { + } else { $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); } + }elseif($input->hasParameterOption('-v')) { + $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); } if (true === $input->hasParameterOption(array('--version', '-V'))) { @@ -923,7 +925,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_OPTIONAL, 'Increase verbosity of messages. Can be between 1 (normal, default), 2 (more verbose) and 3 (maximum)', 1), + 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('--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.'), diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 562c2149b5..6c3d4d6623 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -406,8 +406,8 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $application = new Application(); $application->add(new \FooCommand); $this->ensureStaticCommandHelp($application); - $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml(1) returns an XML representation of the application'); - $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml(2) returns an XML representation of the application'); + $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application'); + $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application'); } public function testRenderException() @@ -503,7 +503,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if --verbose is passed'); $tester->run(array('command' => 'list', '--verbose' => 1)); - $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=1 is passed'); $tester->run(array('command' => 'list', '--verbose' => 2)); $this->assertSame(Output::VERBOSITY_VERY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to very verbose if --verbose=2 is passed'); diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_astext1.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_astext1.txt index 310cd7c166..72c91d39bc 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_astext1.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_astext1.txt @@ -6,7 +6,7 @@ Options: --help -h Display this help message. --quiet -q Do not output any message. - --verbose -v Increase verbosity of messages. Can be between 1 (normal, default), 2 (more verbose) and 3 (maximum) + --verbose -v 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. diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_astext2.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_astext2.txt index fba909afdc..e3bdb2d5af 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_astext2.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_astext2.txt @@ -6,7 +6,7 @@ Options: --help -h Display this help message. --quiet -q Do not output any message. - --verbose -v Increase verbosity of messages. Can be between 1 (normal, default), 2 (more verbose) and 3 (maximum) + --verbose -v 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. diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt index 090367a358..f374f90c3d 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt @@ -39,11 +39,8 @@ - - - -