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

Commit

Permalink
set title for addImage
Browse files Browse the repository at this point in the history
  • Loading branch information
ElfSundae committed Sep 1, 2017
1 parent 5ff427e commit 33568f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Message.php
Expand Up @@ -529,11 +529,12 @@ public function add()
*
* @param string|string[] $image
* @param string $desc
* @param string $title
* @return $this
*/
public function addImage($image, $desc = null)
public function addImage($image, $desc = null, $title = null)
{
return $this->addAttachment($desc, null, $image);
return $this->addAttachment($desc, $title, $image);
}

/**
Expand Down
9 changes: 9 additions & 0 deletions tests/MessageTest.php
Expand Up @@ -476,6 +476,15 @@ public function testAddImage()
'images' => [['url' => 'foo']],
]],
], $message->toArray());

$message = (new Message)->addImage('foo', 'bar', 'title');
$this->assertEquals([
'attachments' => [[
'text' => 'bar',
'title' => 'title',
'images' => [['url' => 'foo']],
]],
], $message->toArray());
}

protected function getClient($defaults = ['user' => 'elf', 'notification' => 'noti', 'attachment_color' => '#f00'])
Expand Down

0 comments on commit 33568f2

Please sign in to comment.