8000 Add proper test case · symfony/symfony@6ee41c6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ee41c6

Browse files
committed
Add proper test case
1 parent 96ed5b8 commit 6ee41c6

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -868,9 +868,12 @@ public function testRenderExceptionEscapesLines()
868868
$application = new Application();
869869
$application->setAutoExit(false);
870870
putenv('COLUMNS=22');
871-
$application->register('foo')->setCode(function () {
872-
throw new \Exception('dont break here <info>!</info>');
873-
});
871+
$application
872+
->register('foo')
873+
->setCode(function () {
874+
throw new \Exception('dont break here <info>!</info>');
875+
})
876+
;
874877
$tester = new ApplicationTester($application);
875878

876879
$tester->run(['command' => 'foo'], ['decorated' => false]);
@@ -940,6 +943,23 @@ public function testRenderExceptionStackTraceContainsRootException()
940943
$this->assertStringContainsString('Dummy type "class@anonymous" is invalid.', $tester->getDisplay(true));
941944
}
942945

946+
public function testRenderExceptionEscapesLinesOfSynopsis()
947+
{
948+
$application = new Application();
949+
$application->setAutoExit(false);
950+
$application
951+
->register('foo')
952+
->setCode(function () {
953+
throw new \Exception('some exception');
954+
})
955+
->addArgument('info')
956+
;
957+
$tester = new ApplicationTester($application);
958+
959+
$tester->run(['command' => 'foo'], ['decorated' => false]);
960+
$this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_rendersynopsis_escapesline.txt', $tester->getDisplay(true), '->renderException() escapes lines containing formatting of synopsis');
961+
}
962+
943963
public function testRun()
944964
{
945965
$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)
0