Quellcode durchsuchen

Do not put empty Slack attachments array by default

Haralan Dobrev vor 9 Jahren
Ursprung
Commit
26b526d9fb

+ 0 - 1
src/Monolog/Handler/Slack/SlackRecord.php

@@ -99,7 +99,6 @@ class SlackRecord
         $dataArray = array(
             'username'    => $this->username,
             'text'        => '',
-            'attachments' => array(),
         );
 
         if ($this->channel) {

+ 2 - 3
tests/Monolog/Handler/Slack/SlackRecordTest.php

@@ -143,13 +143,12 @@ class SlackRecordTest extends TestCase
         $this->assertSame('', $data['text']);
     }
 
-    public function testAttachmentsEmptyIfNoAttachment()
+    public function testAttachmentsNotPresentIfNoAttachment()
     {
         $record = new SlackRecord($this->channel, 'Monolog', false);
         $data = $record->getSlackData($this->getRecord());
 
-        $this->assertArrayHasKey('attachments', $data);
-        $this->assertSame(array(), $data['attachments']);
+        $this->assertArrayNotHasKey('attachments', $data);
     }
 
     public function testAddsOneAttachment()