Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/notifications.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-02-24 13:39:13 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2022-02-25 22:59:02 +0300
commit5846d977a3cd438a47978ed8de6de41f5c91452f (patch)
tree112613e89e77e91d1fda9570aa514f59806a3d5c
parent0edace16cc97771864ca691e3d12450952e0096f (diff)
Do not read the notification we just inserted
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/App.php3
-rw-r--r--tests/Unit/AppTest.php15
2 files changed, 4 insertions, 14 deletions
diff --git a/lib/App.php b/lib/App.php
index c14a6b5..6e5017b 100644
--- a/lib/App.php
+++ b/lib/App.php
@@ -54,8 +54,7 @@ class App implements IDeferrableApp {
$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 4b97dd6..26d540d 100644
--- a/tests/Unit/AppTest.php
+++ b/tests/Unit/AppTest.php
@@ -53,8 +53,8 @@ class AppTest extends TestCase {
public function dataNotify() {
return [
- [23, 'user1'],
- [42, 'user2'],
+ [23],
+ [42],
];
}
@@ -62,21 +62,12 @@ class AppTest extends TestCase {
* @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);