Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 290decf

Browse files
committed
Add proper test case
1 parent 96ed5b8 commit 290decf

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,23 @@ public function testRenderExceptionStackTraceContainsRootException()
940940
$this->assertStringContainsString('Dummy type "class@anonymous" is invalid.', $tester->getDisplay(true));
941941
}
942942

943+
public function testRenderExceptionEscapesLinesOfSynopsis()
944+
{
945+
$application = new Application();
946+
$application->setAutoExit(false);
947+
$application
948+
->register('foo')
949+
->setCode(function () {
950+
throw new \Exception('some exception');
951+
})
952+
->addArgument('info')
953+
;
954+
$tester = new ApplicationTester($application);
955+
956+
$tester->run(['command' => 'foo'], ['decorated' => false]);
957+
$this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_rendersynopsis_escapesline.txt', $tester->getDisplay(true), '->renderException() escapes lines containing formatting of synopsis');
958+
}
959+
943960
public function testRun()
944961
{
945962
$application = new Application();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
In ApplicationTest.php line %d:
3+
4+
some exception
5+
6+
7+
foo [<info>]

0 commit comments

Comments
 (0)