[Console] Added some tests for command shortcuts

This commit is contained in:
Fabien Pennequin 2010-07-17 12:58:23 +02:00 committed by Fabien Potencier
parent 56935f85df
commit 61f18667f4

View File

@ -287,6 +287,9 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$tester->run(array('--ansi' => true));
$this->assertTrue($tester->getOutput()->isDecorated(), '->run() forces color output if --ansi is passed');
$tester->run(array('-a' => true));
$this->assertTrue($tester->getOutput()->isDecorated(), '->run() forces color output if -a is passed');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
@ -294,6 +297,9 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$tester->run(array('--version' => true));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_run4.txt', $tester->getDisplay(), '->run() displays the program version if --version is passed');
$tester->run(array('-V' => true));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_run4.txt', $tester->getDisplay(), '->run() displays the program version if -v is passed');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
@ -301,6 +307,9 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$tester->run(array('command' => 'list', '--quiet' => true));
$this->assertEquals('', $tester->getDisplay(), '->run() removes all output if --quiet is passed');
$tester->run(array('command' => 'list', '-q' => true));
$this->assertEquals('', $tester->getDisplay(), '->run() removes all output if -q is passed');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
@ -308,6 +317,9 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$tester->run(array('command' => 'list', '--verbose' => true));
$this->assertEquals(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose is --verbose is passed');
$tester->run(array('command' => 'list', '-v' => true));
$this->assertEquals(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose is -v is passed');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
@ -315,6 +327,9 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$tester = new ApplicationTester($application);
$tester->run(array('command' => 'foo:bar', '--no-interaction' => true));
$this->assertEquals("called\n", $tester->getDisplay(), '->run() does not called interact() if --no-interaction is passed');
$tester->run(array('command' => 'foo:bar', '-n' => true));
$this->assertEquals("called\n", $tester->getDisplay(), '->run() does not called interact() if -n is passed');
}
}