From 26b526d9fb5acb7da74299f18e969fa3ea6f7e28 Mon Sep 17 00:00:00 2001 From: Haralan Dobrev Date: Sat, 19 Nov 2016 13:39:27 +0200 Subject: [PATCH] Do not put empty Slack attachments array by default --- src/Monolog/Handler/Slack/SlackRecord.php | 1 - tests/Monolog/Handler/Slack/SlackRecordTest.php | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Monolog/Handler/Slack/SlackRecord.php b/src/Monolog/Handler/Slack/SlackRecord.php index 14325021..cb0b8717 100644 --- a/src/Monolog/Handler/Slack/SlackRecord.php +++ b/src/Monolog/Handler/Slack/SlackRecord.php @@ -99,7 +99,6 @@ class SlackRecord $dataArray = array( 'username' => $this->username, 'text' => '', - 'attachments' => array(), ); if ($this->channel) { diff --git a/tests/Monolog/Handler/Slack/SlackRecordTest.php b/tests/Monolog/Handler/Slack/SlackRecordTest.php index 351b92d3..d6c6c229 100644 --- a/tests/Monolog/Handler/Slack/SlackRecordTest.php +++ b/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()