diff --git a/lib/App.php b/lib/App.php index c14a6b5c7..6e5017bc1 100644 --- a/lib/App.php +++ b/lib/App.php @@ -54,8 +54,7 @@ public function notify(INotification $notification): void { $notificationId = $this->handler->add($notification); try { - $notificationToPush = $this->handler->getById($notificationId, $notification->getUser()); - $this->push->pushToDevice($notificationId, $notificationToPush); + $this->push->pushToDevice($notificationId, $notification); } catch (NotificationNotFoundException $e) { throw new \InvalidArgumentException('Error while preparing push notification'); } diff --git a/tests/Unit/AppTest.php b/tests/Unit/AppTest.php index 4b97dd6c4..26d540d41 100644 --- a/tests/Unit/AppTest.php +++ b/tests/Unit/AppTest.php @@ -53,8 +53,8 @@ protected function setUp(): void { public function dataNotify() { return [ - [23, 'user1'], - [42, 'user2'], + [23], + [42], ]; } @@ -62,21 +62,12 @@ public function dataNotify() { * @dataProvider dataNotify * * @param int $id - * @param string $user */ - public function testNotify($id, $user) { - $this->notification->expects($this->once()) - ->method('getUser') - ->willReturn($user); - + public function testNotify($id) { $this->handler->expects($this->once()) ->method('add') ->with($this->notification) ->willReturn($id); - $this->handler->expects($this->once()) - ->method('getById') - ->with($id, $user) - ->willReturn($this->notification); $this->push->expects($this->once()) ->method('pushToDevice') ->with($id, $this->notification);