Skip to content

Commit

Permalink
[Console] Add test for --verbose before argument
Browse files Browse the repository at this point in the history
  • Loading branch information
chEbba committed Nov 22, 2013
1 parent e49ca36 commit 5e03e9a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Symfony/Component/Console/Tests/ApplicationTest.php
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
Expand All @@ -22,6 +23,7 @@
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\Console\Tester\ApplicationTester;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
Expand Down Expand Up @@ -601,6 +603,29 @@ public function testRun()
$this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if -n is passed');
}

/**
* Issue #9285
*
* If the "verbose" option is just before an argument in ArgvInput,
* an argument value should not be treated as verbosity value.
* This test will fail with "Not enough arguments." if broken
*/
public function testVerboseValueNotBreakArguments()
{
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
$application->add(new \FooCommand());

$output = new StreamOutput(fopen('php://memory', 'w', false));

$input = new ArgvInput(array('cli.php', '-v', 'foo:bar'));
$application->run($input, $output);

$input = new ArgvInput(array('cli.php', '--verbose', 'foo:bar'));
$application->run($input, $output);
}

public function testRunReturnsIntegerExitCode()
{
$exception = new \Exception('', 4);
Expand Down

0 comments on commit 5e03e9a

Please sign in to comment.