diff options
Diffstat (limited to 'plugins/Monolog/tests')
-rw-r--r-- | plugins/Monolog/tests/Unit/Formatter/LineMessageFormatterTest.php | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/plugins/Monolog/tests/Unit/Formatter/LineMessageFormatterTest.php b/plugins/Monolog/tests/Unit/Formatter/LineMessageFormatterTest.php index eac798e9c7..c98182e357 100644 --- a/plugins/Monolog/tests/Unit/Formatter/LineMessageFormatterTest.php +++ b/plugins/Monolog/tests/Unit/Formatter/LineMessageFormatterTest.php @@ -64,7 +64,7 @@ class LineMessageFormatterTest extends \PHPUnit_Framework_TestCase */ public function it_should_indent_multiline_message() { - $formatter = new LineMessageFormatter('%message%'); + $formatter = new LineMessageFormatter('%level% %message%'); $record = array( 'message' => "Hello world\ntest\ntest", @@ -73,7 +73,7 @@ class LineMessageFormatterTest extends \PHPUnit_Framework_TestCase ); $formatted = <<<LOG -Hello world +ERROR Hello world test test @@ -81,4 +81,28 @@ LOG; $this->assertEquals($formatted, $formatter->format($record)); } + + /** + * @test + */ + public function it_should_split_inline_line_breaks_into_many_messages_if_disabled() + { + $formatter = new LineMessageFormatter('%level% %message%', $allowInlineLineBreaks = false); + + $record = array( + 'message' => "Hello world\ntest\ntest", + 'datetime' => DateTime::createFromFormat('U', 0), + 'level_name' => 'ERROR', + 'extra' => array('request_id' => '1234') + ); + + $formatted = <<<LOG +ERROR [1234] Hello world +ERROR [1234] test +ERROR [1234] test + +LOG; + + $this->assertEquals($formatted, $formatter->format($record)); + } } |