Skip to content

Commit

Permalink
Remove empty icon
Browse files Browse the repository at this point in the history
Closes #130
  • Loading branch information
cretueusebiu committed Jan 8, 2021
1 parent 4328a6c commit 278e6f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/WebPushMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function title($value)
*/
public function action($title, $action, $icon = null)
{
$this->actions[] = compact('title', 'action', 'icon');
$this->actions[] = array_filter(compact('title', 'action', 'icon'));

return $this;
}
Expand Down
10 changes: 10 additions & 0 deletions tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ public function title_can_be_set()

/** @test */
public function action_can_be_set()
{
$this->message->action('Some Action', 'some_action');

$this->assertEquals(
[['title' => 'Some Action', 'action' => 'some_action']], $this->message->toArray()['actions']
);
}

/** @test */
public function action_can_be_set_with_icon()
{
$this->message->action('Some Action', 'some_action', '/icon.png');

Expand Down

0 comments on commit 278e6f6

Please sign in to comment.