Procházet zdrojové kódy

Add a record with an object as context

George Mponos před 7 roky
rodič
revize
68e39bd84f
1 změnil soubory, kde provedl 8 přidání a 0 odebrání
  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']);
         $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()
     public function testExcludeExtraAndContextFields()
     {
     {
         $record = $this->getRecord(
         $record = $this->getRecord(