minor #25794 [Console] Add placeholder for line number in console exception fixtures (pierredup)

This PR was squashed before being merged into the 3.4 branch (closes #25794).

Discussion
----------

[Console] Add placeholder for line number in console exception fixtures

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Add placeholders for exception line numbers for tests in `ApplicationTest` to make the tests more flexible

Commits
-------

686d4f7 [Console] Add placeholder for line number in console exception fixtures
This commit is contained in:
Robin Chalas 2018-01-15 16:23:33 +01:00
commit 069236e770
6 changed files with 10 additions and 10 deletions

View File

@ -728,10 +728,10 @@ class ApplicationTest extends TestCase
$tester = new ApplicationTester($application);
$tester->run(array('command' => 'foo'), array('decorated' => false, 'capture_stderr_separately' => true));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth1.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions');
$this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_doublewidth1.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions');
$tester->run(array('command' => 'foo'), array('decorated' => true, 'capture_stderr_separately' => true));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth1decorated.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions');
$this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_doublewidth1decorated.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions');
$application = new Application();
$application->setAutoExit(false);
@ -741,7 +741,7 @@ class ApplicationTest extends TestCase
});
$tester = new ApplicationTester($application);
$tester->run(array('command' => 'foo'), array('decorated' => false, 'capture_stderr_separately' => true));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth2.txt', $tester->getErrorOutput(true), '->renderException() wraps messages when they are bigger than the terminal');
$this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_doublewidth2.txt', $tester->getErrorOutput(true), '->renderException() wraps messages when they are bigger than the terminal');
putenv('COLUMNS=120');
}
@ -756,7 +756,7 @@ class ApplicationTest extends TestCase
$tester = new ApplicationTester($application);
$tester->run(array('command' => 'foo'), array('decorated' => false));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_escapeslines.txt', $tester->getDisplay(true), '->renderException() escapes lines containing formatting');
$this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_escapeslines.txt', $tester->getDisplay(true), '->renderException() escapes lines containing formatting');
putenv('COLUMNS=120');
}
@ -773,7 +773,7 @@ class ApplicationTest extends TestCase
$tester = new ApplicationTester($application);
$tester->run(array('command' => 'foo'), array('decorated' => false));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_linebreaks.txt', $tester->getDisplay(true), '->renderException() keep multiple line breaks');
$this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_linebreaks.txt', $tester->getDisplay(true), '->renderException() keep multiple line breaks');
}
public function testRun()

View File

@ -1,5 +1,5 @@
In ApplicationTest.php line 726:
In ApplicationTest.php line %d:
エラーメッセージ

View File

@ -1,5 +1,5 @@
In ApplicationTest.php line 726:
In ApplicationTest.php line %d:
 
 エラーメッセージ 
 

View File

@ -1,5 +1,5 @@
In ApplicationTest.php line 740:
In ApplicationTest.php line %d:
コマンドの実行中にエラーが
発生しました。

View File

@ -1,5 +1,5 @@
In ApplicationTest.php line 754:
In ApplicationTest.php line %d:
dont break here <
info>!</info>

View File

@ -1,5 +1,5 @@
In ApplicationTest.php line 771:
In ApplicationTest.php line %d:
line 1 with extra spaces
line 2