Skip to content

Commit 278e6f6

Browse files
committed
Remove empty icon
Closes #130
1 parent 4328a6c commit 278e6f6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/WebPushMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function title($value)
102102
*/
103103
public function action($title, $action, $icon = null)
104104
{
105-
$this->actions[] = compact('title', 'action', 'icon');
105+
$this->actions[] = array_filter(compact('title', 'action', 'icon'));
106106

107107
return $this;
108108
}

tests/MessageTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ public function title_can_be_set()
2727

2828
/** @test */
2929
public function action_can_be_set()
30+
{
31+
$this->message->action('Some Action', 'some_action');
32+
33+
$this->assertEquals(
34+
[['title' => 'Some Action', 'action' => 'some_action']], $this->message->toArray()['actions']
35+
);
36+
}
37+
38+
/** @test */
39+
public function action_can_be_set_with_icon()
3040
{
3141
$this->message->action('Some Action', 'some_action', '/icon.png');
3242

0 commit comments

Comments
 (0)