From 68e39bd84f4ba24d9bc36bd44dfaa4dfd75c5c45 Mon Sep 17 00:00:00 2001 From: George Mponos Date: Sun, 18 Mar 2018 11:30:04 +0200 Subject: [PATCH] Add a record with an object as context --- tests/Monolog/Handler/Slack/SlackRecordTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/Monolog/Handler/Slack/SlackRecordTest.php b/tests/Monolog/Handler/Slack/SlackRecordTest.php index e1aa96d7..ae42393c 100644 --- a/tests/Monolog/Handler/Slack/SlackRecordTest.php +++ b/tests/Monolog/Handler/Slack/SlackRecordTest.php @@ -353,6 +353,14 @@ class SlackRecordTest extends TestCase $this->assertSame($record['datetime']->getTimestamp(), $attachment['ts']); } + public function testContextHasException() + { + $record = $this->getRecord(Logger::CRITICAL, 'This is a critical message.', array('exception' => new \Exception())); + $slackRecord = new SlackRecord(null, null, true, null, false, true); + $data = $slackRecord->getSlackData($record); + $this->assertInternalType('string', $data['attachments'][0]['fields'][1]['value']); + } + public function testExcludeExtraAndContextFields() { $record = $this->getRecord(