Skip to content

Commit

Permalink
Merge pull request #57 from kodjunkie/dev
Browse files Browse the repository at this point in the history
Enhancements
  • Loading branch information
kodjunkie authored Aug 11, 2022
2 parents c75e803 + 633d888 commit dd4c9ce
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 36 deletions.
72 changes: 36 additions & 36 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions tests/Endpoints/NotificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit dd4c9ce

Please sign in to comment.