diff --git a/composer.lock b/composer.lock index fbf6697..1ba5e20 100644 --- a/composer.lock +++ b/composer.lock @@ -422,16 +422,16 @@ }, { "name": "illuminate/collections", - "version": "v9.21.3", + "version": "v9.24.0", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", - "reference": "9b862a8e7c0da5b00af75b1422d3a29080ef7adb" + "reference": "f9eddfa8599dd224df618b08b2502720027d1f10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/collections/zipball/9b862a8e7c0da5b00af75b1422d3a29080ef7adb", - "reference": "9b862a8e7c0da5b00af75b1422d3a29080ef7adb", + "url": "https://api.github.com/repos/illuminate/collections/zipball/f9eddfa8599dd224df618b08b2502720027d1f10", + "reference": "f9eddfa8599dd224df618b08b2502720027d1f10", "shasum": "" }, "require": { @@ -473,20 +473,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-07-18T13:54:30+00:00" + "time": "2022-08-09T13:26:41+00:00" }, { "name": "illuminate/conditionable", - "version": "v9.21.3", + "version": "v9.24.0", "source": { "type": "git", "url": "https://github.com/illuminate/conditionable.git", - "reference": "46b7beed47948bd2e67f523d0a76daa62775031e" + "reference": "5b40f51ccb07e0e7b1ec5559d8db9e0e2dc51883" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/conditionable/zipball/46b7beed47948bd2e67f523d0a76daa62775031e", - "reference": "46b7beed47948bd2e67f523d0a76daa62775031e", + "url": "https://api.github.com/repos/illuminate/conditionable/zipball/5b40f51ccb07e0e7b1ec5559d8db9e0e2dc51883", + "reference": "5b40f51ccb07e0e7b1ec5559d8db9e0e2dc51883", "shasum": "" }, "require": { @@ -519,20 +519,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-05-31T14:47:50+00:00" + "time": "2022-07-29T19:44:19+00:00" }, { "name": "illuminate/contracts", - "version": "v9.21.3", + "version": "v9.24.0", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "e014cf88ef46065b8b1f078893c01189b95ffb11" + "reference": "ac7f63520e18721f214e80fa7e8f0a5c77ed2719" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/e014cf88ef46065b8b1f078893c01189b95ffb11", - "reference": "e014cf88ef46065b8b1f078893c01189b95ffb11", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/ac7f63520e18721f214e80fa7e8f0a5c77ed2719", + "reference": "ac7f63520e18721f214e80fa7e8f0a5c77ed2719", "shasum": "" }, "require": { @@ -567,20 +567,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-06-07T19:28:00+00:00" + "time": "2022-07-26T14:41:38+00:00" }, { "name": "illuminate/macroable", - "version": "v9.21.3", + "version": "v9.24.0", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", - "reference": "25a2c6dac2b7541ecbadef952702e84ae15f5354" + "reference": "e3bfaf6401742a9c6abca61b9b10e998e5b6449a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/macroable/zipball/25a2c6dac2b7541ecbadef952702e84ae15f5354", - "reference": "25a2c6dac2b7541ecbadef952702e84ae15f5354", + "url": "https://api.github.com/repos/illuminate/macroable/zipball/e3bfaf6401742a9c6abca61b9b10e998e5b6449a", + "reference": "e3bfaf6401742a9c6abca61b9b10e998e5b6449a", "shasum": "" }, "require": { @@ -613,20 +613,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-02-01T14:44:21+00:00" + "time": "2022-08-09T13:29:29+00:00" }, { "name": "illuminate/support", - "version": "v9.21.3", + "version": "v9.24.0", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "f0ef83d1dc4e31d9fe4a37e4089113560244a770" + "reference": "dc872a2a5a6ac8fe14431d7286f4ec4f70b6ac4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/f0ef83d1dc4e31d9fe4a37e4089113560244a770", - "reference": "f0ef83d1dc4e31d9fe4a37e4089113560244a770", + "url": "https://api.github.com/repos/illuminate/support/zipball/dc872a2a5a6ac8fe14431d7286f4ec4f70b6ac4b", + "reference": "dc872a2a5a6ac8fe14431d7286f4ec4f70b6ac4b", "shasum": "" }, "require": { @@ -682,20 +682,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-07-20T13:13:03+00:00" + "time": "2022-08-09T06:51:20+00:00" }, { "name": "nesbot/carbon", - "version": "2.59.1", + "version": "2.61.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "a9000603ea337c8df16cc41f8b6be95a65f4d0f5" + "reference": "bdf4f4fe3a3eac4de84dbec0738082a862c68ba6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/a9000603ea337c8df16cc41f8b6be95a65f4d0f5", - "reference": "a9000603ea337c8df16cc41f8b6be95a65f4d0f5", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/bdf4f4fe3a3eac4de84dbec0738082a862c68ba6", + "reference": "bdf4f4fe3a3eac4de84dbec0738082a862c68ba6", "shasum": "" }, "require": { @@ -784,7 +784,7 @@ "type": "tidelift" } ], - "time": "2022-06-29T21:43:55+00:00" + "time": "2022-08-06T12:41:24+00:00" }, { "name": "psr/container", @@ -1329,16 +1329,16 @@ }, { "name": "symfony/translation", - "version": "v6.1.0", + "version": "v6.1.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "b254416631615bc6fe49b0a67f18658827288147" + "reference": "b042e16087d298d08c1f013ff505d16c12a3b1be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/b254416631615bc6fe49b0a67f18658827288147", - "reference": "b254416631615bc6fe49b0a67f18658827288147", + "url": "https://api.github.com/repos/symfony/translation/zipball/b042e16087d298d08c1f013ff505d16c12a3b1be", + "reference": "b042e16087d298d08c1f013ff505d16c12a3b1be", "shasum": "" }, "require": { @@ -1405,7 +1405,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.1.0" + "source": "https://github.com/symfony/translation/tree/v6.1.3" }, "funding": [ { @@ -1421,7 +1421,7 @@ "type": "tidelift" } ], - "time": "2022-05-11T12:12:29+00:00" + "time": "2022-07-20T13:46:29+00:00" }, { "name": "symfony/translation-contracts", diff --git a/tests/Endpoints/NotificationTest.php b/tests/Endpoints/NotificationTest.php index fa8db0d..e2630c0 100644 --- a/tests/Endpoints/NotificationTest.php +++ b/tests/Endpoints/NotificationTest.php @@ -48,6 +48,61 @@ public function test_it_can_get_all_notifications() $this->assertTrue($success); } + public function test_it_can_get_a_notification() + { + $notificationId = 'notification-id'; + $this->client->expects()->get('notifications/' . $notificationId, [ + 'app_id' => $this->config['app_id'] + ])->once()->andReturn(true); + + $success = (bool)$this->notification->get($notificationId); + $this->assertTrue($success); + } + + public function test_it_can_create_a_notification() + { + $playerId = 'player-id'; + $payload = [ + 'include_player_ids' => [$playerId], + 'contents' => ['en' => 'Thank you for subscribing.'], + 'headings' => ['en' => 'Subscription success'], + 'data' => ['extra' => 'Some extra details'] + ]; + $this->client->expects()->post('notifications', array_merge([ + 'app_id' => $this->config['app_id'] + ], $payload))->once()->andReturn(true); + + $success = (bool)$this->notification->create($payload); + $this->assertTrue($success); + } + + public function test_it_can_cancel_a_notification() + { + $notificationId = 'notification-id'; + $this->client->expects()->delete('notifications/' . $notificationId, [ + 'app_id' => $this->config['app_id'] + ])->once()->andReturn(true); + + $success = (bool)$this->notification->cancel($notificationId); + $this->assertTrue($success); + } + + public function test_it_can_get_a_notification_history() + { + $notificationId = 'notification-id'; + $email = 'tester@gmail.ccom'; + $event = Notification::SENT_EVENT; + + $this->client->expects()->post('notifications/' . $notificationId . '/history', [ + 'app_id' => $this->config['app_id'], + 'email' => $email, + 'events' => $event + ])->once()->andReturn(true); + + $success = (bool)$this->notification->history($notificationId, $email, $event); + $this->assertTrue($success); + } + /** * This method is called after each test. */