Skip to content

Commit 080269d

Browse files
authored
Merge pull request #112 from MustafaOmarIbrahim/patch-1
Adding the ability to add an icon to the action.
2 parents 5910eee + 9ddd256 commit 080269d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/WebPushMessage.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,12 @@ public function title($value)
9797
*
9898
* @param string $title
9999
* @param string $action
100+
* @param string $icon
100101
* @return $this
101102
*/
102-
public function action($title, $action)
103+
public function action($title, $action, $icon = null)
103104
{
104-
$this->actions[] = compact('title', 'action');
105+
$this->actions[] = compact('title', 'action', 'icon');
105106

106107
return $this;
107108
}

tests/MessageTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ public function title_can_be_set()
2828
/** @test */
2929
public function action_can_be_set()
3030
{
31-
$this->message->action('Some Action', 'some_action');
31+
$this->message->action('Some Action', 'some_action', '/icon.png');
3232

33-
$this->assertEquals([['title' => 'Some Action', 'action' => 'some_action']], $this->message->toArray()['actions']);
33+
$this->assertEquals(
34+
[['title' => 'Some Action', 'action' => 'some_action', 'icon' => '/icon.png']], $this->message->toArray()['actions']
35+
);
3436
}
3537

3638
/** @test */

0 commit comments

Comments
 (0)