public function ApplicationTest::testRenderException in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Tests/ApplicationTest.php \Symfony\Component\Console\Tests\ApplicationTest::testRenderException()
File
- vendor/
symfony/ console/ Tests/ ApplicationTest.php, line 517
Class
Namespace
Symfony\Component\Console\TestsCode
public function testRenderException() {
$application = $this
->getMock('Symfony\\Component\\Console\\Application', array(
'getTerminalWidth',
));
$application
->setAutoExit(false);
$application
->expects($this
->any())
->method('getTerminalWidth')
->will($this
->returnValue(120));
$tester = new ApplicationTester($application);
$tester
->run(array(
'command' => 'foo',
), array(
'decorated' => false,
));
$this
->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception1.txt', $tester
->getDisplay(true), '->renderException() renders a pretty exception');
$tester
->run(array(
'command' => 'foo',
), array(
'decorated' => false,
'verbosity' => Output::VERBOSITY_VERBOSE,
));
$this
->assertContains('Exception trace', $tester
->getDisplay(), '->renderException() renders a pretty exception with a stack trace when verbosity is verbose');
$tester
->run(array(
'command' => 'list',
'--foo' => true,
), array(
'decorated' => false,
));
$this
->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception2.txt', $tester
->getDisplay(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command');
$application
->add(new \Foo3Command());
$tester = new ApplicationTester($application);
$tester
->run(array(
'command' => 'foo3:bar',
), array(
'decorated' => false,
));
$this
->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception3.txt', $tester
->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions');
$tester
->run(array(
'command' => 'foo3:bar',
), array(
'decorated' => true,
));
$this
->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception3decorated.txt', $tester
->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions');
$application = $this
->getMock('Symfony\\Component\\Console\\Application', array(
'getTerminalWidth',
));
$application
->setAutoExit(false);
$application
->expects($this
->any())
->method('getTerminalWidth')
->will($this
->returnValue(32));
$tester = new ApplicationTester($application);
$tester
->run(array(
'command' => 'foo',
), array(
'decorated' => false,
));
$this
->assertStringEqualsFile(self::$fixturesPath . '/application_renderexception4.txt', $tester
->getDisplay(true), '->renderException() wraps messages when they are bigger than the terminal');
}