Просмотр исходного кода

Add a record with an object as context

George Mponos 7 лет назад
Родитель
Сommit
68e39bd84f
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      tests/Monolog/Handler/Slack/SlackRecordTest.php

+ 8 - 0
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(