bug #21981 [Console] Use proper line endings in BufferedOutput (julienfalque)
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] Use proper line endings in BufferedOutput
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
`BufferOutput` should be consistent with `StreamOutput` when writing newlines.
I faced an issue using this class in tests where the expected output was platform dependent (using `PHP_EOL` too).
Commits
-------
33946e69c0
Use proper line endings
This commit is contained in:
commit
26198cf60a
@ -42,7 +42,7 @@ class BufferedOutput extends Output
|
||||
$this->buffer .= $message;
|
||||
|
||||
if ($newline) {
|
||||
$this->buffer .= "\n";
|
||||
$this->buffer .= PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class DummyOutput extends BufferedOutput
|
||||
public function getLogs()
|
||||
{
|
||||
$logs = array();
|
||||
foreach (explode("\n", trim($this->fetch())) as $message) {
|
||||
foreach (explode(PHP_EOL, trim($this->fetch())) as $message) {
|
||||
preg_match('/^\[(.*)\] (.*)/', $message, $matches);
|
||||
$logs[] = sprintf('%s %s', $matches[1], $matches[2]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user