From 1c851d2fc3fe71b26cb1a8ad3f186dbdf2bf55ba Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Wed, 21 Dec 2016 09:45:41 +0100 Subject: [PATCH 1/6] Add tests for notification by id --- test/Github/Tests/Api/NotificationTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/Github/Tests/Api/NotificationTest.php b/test/Github/Tests/Api/NotificationTest.php index 70cec8e31c9..6853e9e5260 100644 --- a/test/Github/Tests/Api/NotificationTest.php +++ b/test/Github/Tests/Api/NotificationTest.php @@ -96,6 +96,16 @@ public function shouldMarkNotificationsAsReadForGivenDate() $api->markRead($since); } + public function shouldGetNotification() + { + $id = id + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('/notification'.$id); + + $api->id($id); + } /** * @return string From 5a9ebd4ff4cc987ef9f9a0cd7af95715984b8dc6 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Wed, 21 Dec 2016 09:48:44 +0100 Subject: [PATCH 2/6] Syntax --- test/Github/Tests/Api/NotificationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Github/Tests/Api/NotificationTest.php b/test/Github/Tests/Api/NotificationTest.php index 6853e9e5260..ee0679c6561 100644 --- a/test/Github/Tests/Api/NotificationTest.php +++ b/test/Github/Tests/Api/NotificationTest.php @@ -98,7 +98,7 @@ public function shouldMarkNotificationsAsReadForGivenDate() } public function shouldGetNotification() { - $id = id + $id = id; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') From ac6e1cdbe256d3b6520c9b6fbbef7cc9307654d0 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Wed, 21 Dec 2016 09:50:21 +0100 Subject: [PATCH 3/6] Fix URL --- test/Github/Tests/Api/NotificationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Github/Tests/Api/NotificationTest.php b/test/Github/Tests/Api/NotificationTest.php index ee0679c6561..103dd6d8928 100644 --- a/test/Github/Tests/Api/NotificationTest.php +++ b/test/Github/Tests/Api/NotificationTest.php @@ -102,7 +102,7 @@ public function shouldGetNotification() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('/notification'.$id); + ->with('/notification/'.$id); $api->id($id); } From aaeee89cee9a2a92c5aee0ba348fc523c30bbe5c Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Wed, 21 Dec 2016 09:57:17 +0100 Subject: [PATCH 4/6] Generate random id --- test/Github/Tests/Api/NotificationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Github/Tests/Api/NotificationTest.php b/test/Github/Tests/Api/NotificationTest.php index 103dd6d8928..57e6d6079db 100644 --- a/test/Github/Tests/Api/NotificationTest.php +++ b/test/Github/Tests/Api/NotificationTest.php @@ -98,7 +98,7 @@ public function shouldMarkNotificationsAsReadForGivenDate() } public function shouldGetNotification() { - $id = id; + $id = mt_rand(1, time());; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') From 36f6e9a6a48c51e04bed6b9138991516a94f4537 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Wed, 21 Dec 2016 08:57:21 +0000 Subject: [PATCH 5/6] Apply fixes from StyleCI --- test/Github/Tests/Api/NotificationTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Github/Tests/Api/NotificationTest.php b/test/Github/Tests/Api/NotificationTest.php index 57e6d6079db..77a32549273 100644 --- a/test/Github/Tests/Api/NotificationTest.php +++ b/test/Github/Tests/Api/NotificationTest.php @@ -98,7 +98,8 @@ public function shouldMarkNotificationsAsReadForGivenDate() } public function shouldGetNotification() { - $id = mt_rand(1, time());; + $id = mt_rand(1, time()); + ; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') From 5d4da3fb47d9bbcd2c02402da1d4feb7e297b3c6 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Wed, 21 Dec 2016 12:57:19 +0100 Subject: [PATCH 6/6] Fixes --- test/Github/Tests/Api/NotificationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Github/Tests/Api/NotificationTest.php b/test/Github/Tests/Api/NotificationTest.php index 77a32549273..0f2616996e2 100644 --- a/test/Github/Tests/Api/NotificationTest.php +++ b/test/Github/Tests/Api/NotificationTest.php @@ -96,10 +96,10 @@ public function shouldMarkNotificationsAsReadForGivenDate() $api->markRead($since); } + public function shouldGetNotification() { $id = mt_rand(1, time()); - ; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get')