From 840aa4111d4bc6163c7db74a0390dd79f781fc55 Mon Sep 17 00:00:00 2001 From: "utxo.one" <111649294+utxo-one@users.noreply.github.com> Date: Wed, 9 Nov 2022 02:51:00 -0500 Subject: [PATCH] Notification Tests (#90) * Notification Tests --- tests/NotificationTest.php | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tests/NotificationTest.php diff --git a/tests/NotificationTest.php b/tests/NotificationTest.php new file mode 100644 index 0000000..e74b51e --- /dev/null +++ b/tests/NotificationTest.php @@ -0,0 +1,68 @@ +notificationClient = new Notification($this->host, $this->apiKey); + } + + /** @group getNotifications */ + public function testItCanGetNotifications(): void + { + $notifications = $this->notificationClient->getNotifications(); + + $this->assertInstanceOf(NotificationList::class, $notifications); + foreach ($notifications->all() as $notification) { + $this->assertIsString($notification->getId()); + $this->assertIsString($notification->getBody()); + $this->assertIsString($notification->getLink()); + $this->assertIsInt($notification->getCreatedTime()); + $this->assertIsBool($notification->isSeen()); + } + } + + /** @group getNotification */ + public function testItCanGetNotification(): void + { + $notifications = $this->notificationClient->getNotifications(); + $notification = $this->notificationClient->getNotification($notifications->all()[0]->getId()); + + $this->assertIsString($notification->getId()); + $this->assertIsString($notification->getBody()); + $this->assertIsString($notification->getLink()); + $this->assertIsInt($notification->getCreatedTime()); + $this->assertIsBool($notification->isSeen()); + } + + /** @group updateNotification */ + public function testItCanUpdateNotification(): void + { + $notifications = $this->notificationClient->getNotifications(); + $notification = $this->notificationClient->updateNotification($notifications->all()[0]->getId(), true); + + $this->assertIsString($notification->getId()); + $this->assertIsString($notification->getBody()); + $this->assertIsString($notification->getLink()); + $this->assertIsInt($notification->getCreatedTime()); + $this->assertTrue($notification->isSeen()); + } + + /** @group removeNotification */ + public function testItCanRemoveNotification(): void + { + $notifications = $this->notificationClient->getNotifications(); + $notification = $this->notificationClient->removeNotification($notifications->all()[0]->getId()); + + $this->assertTrue($notification); + } +}