Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ElfSundae committed Sep 1, 2017
1 parent 4f639ce commit 734c1f5
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests/MessageTest.php
Expand Up @@ -213,7 +213,7 @@ public function testRemoveAttachments()
$this->assertEquals([['text' => 'foo'], ['text' => 'bar']], $message->getAttachments());
}

public function testArrayable()
public function testArrayableAndJsonable()
{
$this->assertInternalType('array', (new Message)->toArray());

Expand All @@ -225,6 +225,10 @@ public function testArrayable()
['text' => 'bar'],
],
], $message->toArray());

$this->assertInternalType('string', $json = json_encode($message));
$this->assertEquals($json, $message->toJson());
$this->assertEquals($json, (string) $message);
}

public function testCreateMessageWithDefaultsFromClient()
Expand Down Expand Up @@ -264,6 +268,26 @@ public function testConfigureDefaults()

$message->configureDefaults(['notification' => 'notes'], true);
$this->assertEquals(['user' => 'elf', 'notification' => 'notes'], $message->toArray());

$message->add('text', 'title');
$this->assertEquals([
'user' => 'elf',
'notification' => 'notes',
'attachments' => [[
'text' => 'text',
'title' => 'title',
]],
], $message->toArray());
$message->configureDefaults(['attachment_color' => '#fff'], true);
$this->assertEquals([
'user' => 'elf',
'notification' => 'notes',
'attachments' => [[
'text' => 'text',
'title' => 'title',
'color' => '#fff',
]],
], $message->toArray());
}

public function testSend()
Expand Down

0 comments on commit 734c1f5

Please sign in to comment.