public function testAttachmentCreationFromArray() { $a = new Attachment(['fallback' => 'Fallback', 'text' => 'Text', 'pretext' => 'Pretext', 'color' => 'bad', 'mrkdwn_in' => ['pretext', 'text', 'fields']]); $this->assertEquals('Fallback', $a->getFallback()); $this->assertEquals('Text', $a->getText()); $this->assertEquals('Pretext', $a->getPretext()); $this->assertEquals('bad', $a->getColor()); $this->assertEquals([], $a->getFields()); $this->assertEquals(['pretext', 'text', 'fields'], $a->getMarkdownFields()); }
public function testAttachmentCreationFromArray() { $now = new DateTime(); $a = new Attachment(['fallback' => 'Fallback', 'text' => 'Text', 'pretext' => 'Pretext', 'color' => 'bad', 'footer' => 'Footer', 'footer_icon' => 'https://platform.slack-edge.com/img/default_application_icon.png', 'timestamp' => $now, 'mrkdwn_in' => ['pretext', 'text', 'fields']]); $this->assertEquals('Fallback', $a->getFallback()); $this->assertEquals('Text', $a->getText()); $this->assertEquals('Pretext', $a->getPretext()); $this->assertEquals('bad', $a->getColor()); $this->assertEquals([], $a->getFields()); $this->assertEquals(['pretext', 'text', 'fields'], $a->getMarkdownFields()); $this->assertEquals('Footer', $a->getFooter()); $this->assertEquals('https://platform.slack-edge.com/img/default_application_icon.png', $a->getFooterIcon()); $this->assertEquals($now, $a->getTimestamp()); }