From 51cd04cca6341ccca552127ed5921c24972204c1 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Tue, 2 Aug 2016 17:21:28 +0200 Subject: [PATCH 1/2] Make sure we always use valid urls --- lib/Github/Api/Authorizations.php | 18 ++++----- lib/Github/Api/CurrentUser.php | 22 +++++------ lib/Github/Api/CurrentUser/DeployKeys.php | 10 ++--- lib/Github/Api/CurrentUser/Emails.php | 6 +-- lib/Github/Api/CurrentUser/Followers.php | 8 ++-- lib/Github/Api/CurrentUser/Memberships.php | 6 +-- lib/Github/Api/CurrentUser/Notifications.php | 18 ++++----- lib/Github/Api/CurrentUser/Starring.php | 8 ++-- lib/Github/Api/CurrentUser/Watchers.php | 8 ++-- lib/Github/Api/Deployment.php | 8 ++-- lib/Github/Api/Enterprise/License.php | 2 +- lib/Github/Api/Enterprise/Stats.php | 2 +- lib/Github/Api/Enterprise/UserAdmin.php | 4 +- lib/Github/Api/Gist/Comments.php | 10 ++--- lib/Github/Api/Gists.php | 24 ++++++------ lib/Github/Api/GitData/Commits.php | 4 +- lib/Github/Api/GitData/References.php | 14 +++---- lib/Github/Api/GitData/Tags.php | 6 +-- lib/Github/Api/GitData/Trees.php | 4 +- lib/Github/Api/Issue.php | 12 +++--- lib/Github/Api/Issue/Events.php | 6 +-- lib/Github/Api/Issue/Labels.php | 18 ++++----- lib/Github/Api/Issue/Milestones.php | 12 +++--- lib/Github/Api/Markdown.php | 4 +- lib/Github/Api/Meta.php | 2 +- lib/Github/Api/Notification.php | 4 +- lib/Github/Api/Organization.php | 10 ++--- lib/Github/Api/Organization/Hooks.php | 12 +++--- lib/Github/Api/Organization/Members.php | 18 ++++----- lib/Github/Api/Organization/Teams.php | 26 ++++++------- lib/Github/Api/PullRequest.php | 16 ++++---- lib/Github/Api/PullRequest/Comments.php | 10 ++--- lib/Github/Api/RateLimit.php | 6 +-- lib/Github/Api/Repo.php | 40 ++++++++++---------- lib/Github/Api/Repository/Assets.php | 8 ++-- lib/Github/Api/Repository/Collaborators.php | 8 ++-- lib/Github/Api/Repository/Commits.php | 6 +-- lib/Github/Api/Repository/Contents.php | 14 +++---- lib/Github/Api/Repository/DeployKeys.php | 10 ++--- lib/Github/Api/Repository/Downloads.php | 6 +-- lib/Github/Api/Repository/Forks.php | 4 +- lib/Github/Api/Repository/Hooks.php | 14 +++---- lib/Github/Api/Repository/Labels.php | 10 ++--- lib/Github/Api/Repository/Releases.php | 14 +++---- lib/Github/Api/Repository/Statuses.php | 6 +-- lib/Github/Api/Search.php | 8 ++-- lib/Github/Api/User.php | 28 +++++++------- lib/Github/Client.php | 2 +- 48 files changed, 258 insertions(+), 258 deletions(-) diff --git a/lib/Github/Api/Authorizations.php b/lib/Github/Api/Authorizations.php index b8c4f5bd8fe..5e6853fd773 100644 --- a/lib/Github/Api/Authorizations.php +++ b/lib/Github/Api/Authorizations.php @@ -17,7 +17,7 @@ class Authorizations extends AbstractApi */ public function all() { - return $this->get('authorizations'); + return $this->get('/authorizations'); } /** @@ -29,7 +29,7 @@ public function all() */ public function show($clientId) { - return $this->get('authorizations/'.rawurlencode($clientId)); + return $this->get('/authorizations/'.rawurlencode($clientId)); } /** @@ -44,7 +44,7 @@ public function create(array $params, $OTPCode = null) { $headers = null === $OTPCode ? array() : array('X-GitHub-OTP' => $OTPCode); - return $this->post('authorizations', $params, $headers); + return $this->post('/authorizations', $params, $headers); } /** @@ -57,7 +57,7 @@ public function create(array $params, $OTPCode = null) */ public function update($clientId, array $params) { - return $this->patch('authorizations/'.rawurlencode($clientId), $params); + return $this->patch('/authorizations/'.rawurlencode($clientId), $params); } /** @@ -69,7 +69,7 @@ public function update($clientId, array $params) */ public function remove($clientId) { - return $this->delete('authorizations/'.rawurlencode($clientId)); + return $this->delete('/authorizations/'.rawurlencode($clientId)); } /** @@ -82,7 +82,7 @@ public function remove($clientId) */ public function check($clientId, $token) { - return $this->get('applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token)); + return $this->get('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token)); } /** @@ -95,7 +95,7 @@ public function check($clientId, $token) */ public function reset($clientId, $token) { - return $this->post('applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token)); + return $this->post('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token)); } /** @@ -106,7 +106,7 @@ public function reset($clientId, $token) */ public function revoke($clientId, $token) { - $this->delete('applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token)); + $this->delete('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token)); } /** @@ -116,6 +116,6 @@ public function revoke($clientId, $token) */ public function revokeAll($clientId) { - $this->delete('applications/'.rawurlencode($clientId).'/tokens'); + $this->delete('/applications/'.rawurlencode($clientId).'/tokens'); } } diff --git a/lib/Github/Api/CurrentUser.php b/lib/Github/Api/CurrentUser.php index b525ee185a9..bbaea2daafb 100644 --- a/lib/Github/Api/CurrentUser.php +++ b/lib/Github/Api/CurrentUser.php @@ -19,12 +19,12 @@ class CurrentUser extends AbstractApi { public function show() { - return $this->get('user'); + return $this->get('/user'); } public function update(array $params) { - return $this->patch('user', $params); + return $this->patch('/user', $params); } /** @@ -45,7 +45,7 @@ public function follow() public function followers($page = 1) { - return $this->get('user/followers', array( + return $this->get('/user/followers', array( 'page' => $page )); } @@ -60,7 +60,7 @@ public function followers($page = 1) */ public function issues(array $params = array(), $includeOrgIssues = true) { - return $this->get($includeOrgIssues ? 'issues' : 'user/issues', array_merge(array('page' => 1), $params)); + return $this->get($includeOrgIssues ? '/issues' : '/user/issues', array_merge(array('page' => 1), $params)); } /** @@ -94,7 +94,7 @@ public function memberships() */ public function organizations() { - return $this->get('user/orgs'); + return $this->get('/user/orgs'); } /** @@ -104,7 +104,7 @@ public function organizations() */ public function teams() { - return $this->get('user/teams'); + return $this->get('/user/teams'); } /** @@ -118,7 +118,7 @@ public function teams() */ public function repositories($type = 'owner', $sort = 'full_name', $direction = 'asc') { - return $this->get('user/repos', array( + return $this->get('/user/repos', array( 'type' => $type, 'sort' => $sort, 'direction' => $direction @@ -138,7 +138,7 @@ public function watchers() */ public function watched($page = 1) { - return $this->get('user/watched', array( + return $this->get('/user/watched', array( 'page' => $page )); } @@ -156,16 +156,16 @@ public function starring() */ public function starred($page = 1) { - return $this->get('user/starred', array( + return $this->get('/user/starred', array( 'page' => $page )); } - + /** * @link https://developer.github.com/v3/activity/watching/#list-repositories-being-watched */ public function subscriptions() { - return $this->get('user/subscriptions'); + return $this->get('/user/subscriptions'); } } diff --git a/lib/Github/Api/CurrentUser/DeployKeys.php b/lib/Github/Api/CurrentUser/DeployKeys.php index 66b51033da5..dc8df79941f 100644 --- a/lib/Github/Api/CurrentUser/DeployKeys.php +++ b/lib/Github/Api/CurrentUser/DeployKeys.php @@ -20,7 +20,7 @@ class DeployKeys extends AbstractApi */ public function all() { - return $this->get('user/keys'); + return $this->get('/user/keys'); } /** @@ -34,7 +34,7 @@ public function all() */ public function show($id) { - return $this->get('user/keys/'.rawurlencode($id)); + return $this->get('/user/keys/'.rawurlencode($id)); } /** @@ -54,7 +54,7 @@ public function create(array $params) throw new MissingArgumentException(array('title', 'key')); } - return $this->post('user/keys', $params); + return $this->post('/user/keys', $params); } /** @@ -75,7 +75,7 @@ public function update($id, array $params) throw new MissingArgumentException(array('title', 'key')); } - return $this->patch('user/keys/'.rawurlencode($id), $params); + return $this->patch('/user/keys/'.rawurlencode($id), $params); } /** @@ -89,6 +89,6 @@ public function update($id, array $params) */ public function remove($id) { - return $this->delete('user/keys/'.rawurlencode($id)); + return $this->delete('/user/keys/'.rawurlencode($id)); } } diff --git a/lib/Github/Api/CurrentUser/Emails.php b/lib/Github/Api/CurrentUser/Emails.php index 9a1ce1e6c6d..8155301ed5d 100644 --- a/lib/Github/Api/CurrentUser/Emails.php +++ b/lib/Github/Api/CurrentUser/Emails.php @@ -20,7 +20,7 @@ class Emails extends AbstractApi */ public function all() { - return $this->get('user/emails'); + return $this->get('/user/emails'); } /** @@ -42,7 +42,7 @@ public function add($emails) throw new InvalidArgumentException(); } - return $this->post('user/emails', $emails); + return $this->post('/user/emails', $emails); } /** @@ -64,6 +64,6 @@ public function remove($emails) throw new InvalidArgumentException(); } - return $this->delete('user/emails', $emails); + return $this->delete('/user/emails', $emails); } } diff --git a/lib/Github/Api/CurrentUser/Followers.php b/lib/Github/Api/CurrentUser/Followers.php index 303637740cc..19a8e2d37c8 100644 --- a/lib/Github/Api/CurrentUser/Followers.php +++ b/lib/Github/Api/CurrentUser/Followers.php @@ -21,7 +21,7 @@ class Followers extends AbstractApi */ public function all($page = 1) { - return $this->get('user/following', array( + return $this->get('/user/following', array( 'page' => $page )); } @@ -37,7 +37,7 @@ public function all($page = 1) */ public function check($username) { - return $this->get('user/following/'.rawurlencode($username)); + return $this->get('/user/following/'.rawurlencode($username)); } /** @@ -51,7 +51,7 @@ public function check($username) */ public function follow($username) { - return $this->put('user/following/'.rawurlencode($username)); + return $this->put('/user/following/'.rawurlencode($username)); } /** @@ -65,6 +65,6 @@ public function follow($username) */ public function unfollow($username) { - return $this->delete('user/following/'.rawurlencode($username)); + return $this->delete('/user/following/'.rawurlencode($username)); } } diff --git a/lib/Github/Api/CurrentUser/Memberships.php b/lib/Github/Api/CurrentUser/Memberships.php index 650b348ad9f..df87596c38a 100644 --- a/lib/Github/Api/CurrentUser/Memberships.php +++ b/lib/Github/Api/CurrentUser/Memberships.php @@ -15,7 +15,7 @@ class Memberships extends AbstractApi */ public function all() { - return $this->get('user/memberships/orgs'); + return $this->get('/user/memberships/orgs'); } /** @@ -29,7 +29,7 @@ public function all() */ public function organization($organization) { - return $this->get('user/memberships/orgs/'.rawurlencode($organization)); + return $this->get('/user/memberships/orgs/'.rawurlencode($organization)); } /** @@ -43,6 +43,6 @@ public function organization($organization) */ public function edit($organization) { - return $this->patch('user/memberships/orgs/'.rawurlencode($organization), array('state' => 'active')); + return $this->patch('/user/memberships/orgs/'.rawurlencode($organization), array('state' => 'active')); } } diff --git a/lib/Github/Api/CurrentUser/Notifications.php b/lib/Github/Api/CurrentUser/Notifications.php index fa575eb8e21..ccc2af2aad5 100644 --- a/lib/Github/Api/CurrentUser/Notifications.php +++ b/lib/Github/Api/CurrentUser/Notifications.php @@ -21,7 +21,7 @@ class Notifications extends AbstractApi */ public function all(array $params = array()) { - return $this->get('notifications', $params); + return $this->get('/notifications', $params); } /** @@ -37,7 +37,7 @@ public function all(array $params = array()) */ public function allInRepository($username, $repository, array $params = array()) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params); } /** @@ -51,7 +51,7 @@ public function allInRepository($username, $repository, array $params = array()) */ public function markAsReadAll(array $params = array()) { - return $this->put('notifications', $params); + return $this->put('/notifications', $params); } /** @@ -67,7 +67,7 @@ public function markAsReadAll(array $params = array()) */ public function markAsReadInRepository($username, $repository, array $params = array()) { - return $this->put('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params); + return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params); } /** @@ -82,7 +82,7 @@ public function markAsReadInRepository($username, $repository, array $params = a */ public function markAsRead($id, array $params) { - return $this->patch('notifications/threads/'.rawurlencode($id), $params); + return $this->patch('/notifications/threads/'.rawurlencode($id), $params); } /** @@ -96,7 +96,7 @@ public function markAsRead($id, array $params) */ public function show($id) { - return $this->get('notifications/threads/'.rawurlencode($id)); + return $this->get('/notifications/threads/'.rawurlencode($id)); } /** @@ -110,7 +110,7 @@ public function show($id) */ public function showSubscription($id) { - return $this->get('notifications/threads/'.rawurlencode($id).'/subscription'); + return $this->get('/notifications/threads/'.rawurlencode($id).'/subscription'); } /** @@ -125,7 +125,7 @@ public function showSubscription($id) */ public function createSubscription($id, array $params) { - return $this->put('notifications/threads/'.rawurlencode($id).'/subscription', $params); + return $this->put('/notifications/threads/'.rawurlencode($id).'/subscription', $params); } /** @@ -139,6 +139,6 @@ public function createSubscription($id, array $params) */ public function removeSubscription($id) { - return $this->delete('notifications/threads/'.rawurlencode($id).'/subscription'); + return $this->delete('/notifications/threads/'.rawurlencode($id).'/subscription'); } } diff --git a/lib/Github/Api/CurrentUser/Starring.php b/lib/Github/Api/CurrentUser/Starring.php index 0e75da2c576..5085af06662 100644 --- a/lib/Github/Api/CurrentUser/Starring.php +++ b/lib/Github/Api/CurrentUser/Starring.php @@ -21,7 +21,7 @@ class Starring extends AbstractApi */ public function all($page = 1) { - return $this->get('user/starred', array( + return $this->get('/user/starred', array( 'page' => $page )); } @@ -38,7 +38,7 @@ public function all($page = 1) */ public function check($username, $repository) { - return $this->get('user/starred/'.rawurlencode($username).'/'.rawurlencode($repository)); + return $this->get('/user/starred/'.rawurlencode($username).'/'.rawurlencode($repository)); } /** @@ -53,7 +53,7 @@ public function check($username, $repository) */ public function star($username, $repository) { - return $this->put('user/starred/'.rawurlencode($username).'/'.rawurlencode($repository)); + return $this->put('/user/starred/'.rawurlencode($username).'/'.rawurlencode($repository)); } /** @@ -68,6 +68,6 @@ public function star($username, $repository) */ public function unstar($username, $repository) { - return $this->delete('user/starred/'.rawurlencode($username).'/'.rawurlencode($repository)); + return $this->delete('/user/starred/'.rawurlencode($username).'/'.rawurlencode($repository)); } } diff --git a/lib/Github/Api/CurrentUser/Watchers.php b/lib/Github/Api/CurrentUser/Watchers.php index 7f7b55457b5..a5a6d9b46f0 100644 --- a/lib/Github/Api/CurrentUser/Watchers.php +++ b/lib/Github/Api/CurrentUser/Watchers.php @@ -22,7 +22,7 @@ class Watchers extends AbstractApi */ public function all($page = 1) { - return $this->get('user/subscriptions', array( + return $this->get('/user/subscriptions', array( 'page' => $page )); } @@ -39,7 +39,7 @@ public function all($page = 1) */ public function check($username, $repository) { - return $this->get('user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository)); + return $this->get('/user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository)); } /** @@ -54,7 +54,7 @@ public function check($username, $repository) */ public function watch($username, $repository) { - return $this->put('user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository)); + return $this->put('/user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository)); } /** @@ -69,6 +69,6 @@ public function watch($username, $repository) */ public function unwatch($username, $repository) { - return $this->delete('user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository)); + return $this->delete('/user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository)); } } diff --git a/lib/Github/Api/Deployment.php b/lib/Github/Api/Deployment.php index eecee8d115b..7b19c25360c 100644 --- a/lib/Github/Api/Deployment.php +++ b/lib/Github/Api/Deployment.php @@ -22,7 +22,7 @@ class Deployment extends AbstractApi */ public function all($username, $repository, array $params = array()) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params); } /** @@ -45,7 +45,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('ref')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params); } /** @@ -68,7 +68,7 @@ public function updateStatus($username, $repository, $id, array $params) throw new MissingArgumentException(array('state')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses', $params); } /** @@ -81,6 +81,6 @@ public function updateStatus($username, $repository, $id, array $params) */ public function getStatuses($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses'); } } diff --git a/lib/Github/Api/Enterprise/License.php b/lib/Github/Api/Enterprise/License.php index de14f23eac3..67e1c2a96ea 100644 --- a/lib/Github/Api/Enterprise/License.php +++ b/lib/Github/Api/Enterprise/License.php @@ -15,6 +15,6 @@ class License extends AbstractApi */ public function show() { - return $this->get('enterprise/settings/license'); + return $this->get('/enterprise/settings/license'); } } diff --git a/lib/Github/Api/Enterprise/Stats.php b/lib/Github/Api/Enterprise/Stats.php index 7af932945a7..7d3b1953892 100644 --- a/lib/Github/Api/Enterprise/Stats.php +++ b/lib/Github/Api/Enterprise/Stats.php @@ -123,6 +123,6 @@ public function all() */ public function show($type) { - return $this->get('enterprise/stats/' . rawurlencode($type)); + return $this->get('/enterprise/stats/' . rawurlencode($type)); } } diff --git a/lib/Github/Api/Enterprise/UserAdmin.php b/lib/Github/Api/Enterprise/UserAdmin.php index 5a14114bca2..8f6ad10d91a 100644 --- a/lib/Github/Api/Enterprise/UserAdmin.php +++ b/lib/Github/Api/Enterprise/UserAdmin.php @@ -17,7 +17,7 @@ class UserAdmin extends AbstractApi */ public function suspend($username) { - return $this->put('users/'.rawurldecode($username).'/suspended', array('Content-Length' => 0)); + return $this->put('/users/'.rawurldecode($username).'/suspended', array('Content-Length' => 0)); } /** @@ -31,6 +31,6 @@ public function suspend($username) */ public function unsuspend($username) { - return $this->delete('users/'.rawurldecode($username).'/suspended'); + return $this->delete('/users/'.rawurldecode($username).'/suspended'); } } diff --git a/lib/Github/Api/Gist/Comments.php b/lib/Github/Api/Gist/Comments.php index 7db73e59b29..521e4d03bb4 100644 --- a/lib/Github/Api/Gist/Comments.php +++ b/lib/Github/Api/Gist/Comments.php @@ -19,7 +19,7 @@ class Comments extends AbstractApi */ public function all($gist) { - return $this->get('gists/'.rawurlencode($gist).'/comments'); + return $this->get('/gists/'.rawurlencode($gist).'/comments'); } /** @@ -32,7 +32,7 @@ public function all($gist) */ public function show($gist, $comment) { - return $this->get('gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment)); + return $this->get('/gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment)); } /** @@ -45,7 +45,7 @@ public function show($gist, $comment) */ public function create($gist, $body) { - return $this->post('gists/'.rawurlencode($gist).'/comments', array('body' => $body)); + return $this->post('/gists/'.rawurlencode($gist).'/comments', array('body' => $body)); } /** @@ -59,7 +59,7 @@ public function create($gist, $body) */ public function update($gist, $comment_id, $body) { - return $this->patch('gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment_id), array('body' => $body)); + return $this->patch('/gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment_id), array('body' => $body)); } /** @@ -72,6 +72,6 @@ public function update($gist, $comment_id, $body) */ public function remove($gist, $comment) { - return $this->delete('gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment)); + return $this->delete('/gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment)); } } diff --git a/lib/Github/Api/Gists.php b/lib/Github/Api/Gists.php index 07e8e1342f7..9710e6de683 100644 --- a/lib/Github/Api/Gists.php +++ b/lib/Github/Api/Gists.php @@ -17,15 +17,15 @@ class Gists extends AbstractApi public function all($type = null) { if (!in_array($type, array('public', 'starred'))) { - return $this->get('gists'); + return $this->get('/gists'); } - return $this->get('gists/'.rawurlencode($type)); + return $this->get('/gists/'.rawurlencode($type)); } public function show($number) { - return $this->get('gists/'.rawurlencode($number)); + return $this->get('/gists/'.rawurlencode($number)); } public function create(array $params) @@ -36,47 +36,47 @@ public function create(array $params) $params['public'] = (bool) $params['public']; - return $this->post('gists', $params); + return $this->post('/gists', $params); } public function update($id, array $params) { - return $this->patch('gists/'.rawurlencode($id), $params); + return $this->patch('/gists/'.rawurlencode($id), $params); } public function commits($id) { - return $this->get('gists/'.rawurlencode($id).'/commits'); + return $this->get('/gists/'.rawurlencode($id).'/commits'); } public function fork($id) { - return $this->post('gists/'.rawurlencode($id).'/fork'); + return $this->post('/gists/'.rawurlencode($id).'/fork'); } public function forks($id) { - return $this->get('gists/'.rawurlencode($id).'/forks'); + return $this->get('/gists/'.rawurlencode($id).'/forks'); } public function remove($id) { - return $this->delete('gists/'.rawurlencode($id)); + return $this->delete('/gists/'.rawurlencode($id)); } public function check($id) { - return $this->get('gists/'.rawurlencode($id).'/star'); + return $this->get('/gists/'.rawurlencode($id).'/star'); } public function star($id) { - return $this->put('gists/'.rawurlencode($id).'/star'); + return $this->put('/gists/'.rawurlencode($id).'/star'); } public function unstar($id) { - return $this->delete('gists/'.rawurlencode($id).'/star'); + return $this->delete('/gists/'.rawurlencode($id).'/star'); } /** diff --git a/lib/Github/Api/GitData/Commits.php b/lib/Github/Api/GitData/Commits.php index f2f5d217cda..e8d1bfe9d30 100644 --- a/lib/Github/Api/GitData/Commits.php +++ b/lib/Github/Api/GitData/Commits.php @@ -22,7 +22,7 @@ class Commits extends AbstractApi */ public function show($username, $repository, $sha) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/commits/'.rawurlencode($sha)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/commits/'.rawurlencode($sha)); } /** @@ -42,6 +42,6 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('message', 'tree', 'parents')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/commits', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/commits', $params); } } diff --git a/lib/Github/Api/GitData/References.php b/lib/Github/Api/GitData/References.php index 3277b79e2b7..906a6ffc117 100644 --- a/lib/Github/Api/GitData/References.php +++ b/lib/Github/Api/GitData/References.php @@ -21,7 +21,7 @@ class References extends AbstractApi */ public function all($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs'); } /** @@ -34,7 +34,7 @@ public function all($username, $repository) */ public function branches($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/heads'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/heads'); } /** @@ -47,7 +47,7 @@ public function branches($username, $repository) */ public function tags($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags'); } /** @@ -63,7 +63,7 @@ public function show($username, $repository, $reference) { $reference = $this->encodeReference($reference); - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference); } /** @@ -83,7 +83,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('ref', 'sha')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs', $params); } /** @@ -106,7 +106,7 @@ public function update($username, $repository, $reference, array $params) $reference = $this->encodeReference($reference); - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference, $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference, $params); } /** @@ -122,7 +122,7 @@ public function remove($username, $repository, $reference) { $reference = $this->encodeReference($reference); - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference); } /** diff --git a/lib/Github/Api/GitData/Tags.php b/lib/Github/Api/GitData/Tags.php index 4b2d0341ef3..d1caefe91f1 100644 --- a/lib/Github/Api/GitData/Tags.php +++ b/lib/Github/Api/GitData/Tags.php @@ -21,7 +21,7 @@ class Tags extends AbstractApi */ public function all($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags'); } /** @@ -35,7 +35,7 @@ public function all($username, $repository) */ public function show($username, $repository, $sha) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags/'.rawurlencode($sha)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags/'.rawurlencode($sha)); } /** @@ -63,6 +63,6 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('tagger.name', 'tagger.email', 'tagger.date')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags', $params); } } diff --git a/lib/Github/Api/GitData/Trees.php b/lib/Github/Api/GitData/Trees.php index 3fe61cdb236..80885682232 100644 --- a/lib/Github/Api/GitData/Trees.php +++ b/lib/Github/Api/GitData/Trees.php @@ -23,7 +23,7 @@ class Trees extends AbstractApi */ public function show($username, $repository, $sha, $recursive = false) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees/'.rawurlencode($sha), $recursive ? array('recursive' => 1) : array()); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees/'.rawurlencode($sha), $recursive ? array('recursive' => 1) : array()); } /** @@ -58,6 +58,6 @@ public function create($username, $repository, array $params) } } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees', $params); } } diff --git a/lib/Github/Api/Issue.php b/lib/Github/Api/Issue.php index c1b9a6e7992..f1f41d92ed1 100644 --- a/lib/Github/Api/Issue.php +++ b/lib/Github/Api/Issue.php @@ -31,7 +31,7 @@ class Issue extends AbstractApi */ public function all($username, $repository, array $params = array()) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', array_merge(array('page' => 1), $params)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', array_merge(array('page' => 1), $params)); } /** @@ -52,7 +52,7 @@ public function find($username, $repository, $state, $keyword) $state = 'open'; } - return $this->get('legacy/issues/search/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($state).'/'.rawurlencode($keyword)); + return $this->get('/legacy/issues/search/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($state).'/'.rawurlencode($keyword)); } /** @@ -72,7 +72,7 @@ public function org($organization, $state, array $params = array()) $state = 'open'; } - return $this->get('orgs/'.rawurlencode($organization).'/issues', array_merge(array('page' => 1, 'state' => $state), $params)); + return $this->get('/orgs/'.rawurlencode($organization).'/issues', array_merge(array('page' => 1, 'state' => $state), $params)); } /** @@ -88,7 +88,7 @@ public function org($organization, $state, array $params = array()) */ public function show($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id)); } /** @@ -111,7 +111,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('title', 'body')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', $params); } /** @@ -129,7 +129,7 @@ public function create($username, $repository, array $params) */ public function update($username, $repository, $id, array $params) { - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id), $params); } /** diff --git a/lib/Github/Api/Issue/Events.php b/lib/Github/Api/Issue/Events.php index 1fa5dc502e3..adfcde83e5e 100644 --- a/lib/Github/Api/Issue/Events.php +++ b/lib/Github/Api/Issue/Events.php @@ -23,9 +23,9 @@ class Events extends AbstractApi public function all($username, $repository, $issue = null, $page = 1) { if (null !== $issue) { - $path = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/events'; + $path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/events'; } else { - $path = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events'; + $path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events'; } return $this->get($path, array( @@ -44,6 +44,6 @@ public function all($username, $repository, $issue = null, $page = 1) */ public function show($username, $repository, $event) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events/'.rawurlencode($event)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events/'.rawurlencode($event)); } } diff --git a/lib/Github/Api/Issue/Labels.php b/lib/Github/Api/Issue/Labels.php index 0a67445d4e3..8f27887acfb 100644 --- a/lib/Github/Api/Issue/Labels.php +++ b/lib/Github/Api/Issue/Labels.php @@ -25,9 +25,9 @@ class Labels extends AbstractApi public function all($username, $repository, $issue = null) { if ($issue === null) { - $path = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels'; + $path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels'; } else { - $path = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels'; + $path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels'; } return $this->get($path); @@ -54,7 +54,7 @@ public function create($username, $repository, array $params) $params['color'] = 'FFFFFF'; } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels', $params); } /** @@ -69,7 +69,7 @@ public function create($username, $repository, array $params) */ public function deleteLabel($username, $repository, $label) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label)); } /** @@ -91,7 +91,7 @@ public function update($username, $repository, $label, $newName, $color) 'color' => $color, ); - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label), $params); } /** @@ -115,7 +115,7 @@ public function add($username, $repository, $issue, $labels) throw new InvalidArgumentException(); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $labels); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $labels); } /** @@ -131,7 +131,7 @@ public function add($username, $repository, $issue, $labels) */ public function replace($username, $repository, $issue, array $params) { - return $this->put('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $params); + return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $params); } /** @@ -147,7 +147,7 @@ public function replace($username, $repository, $issue, array $params) */ public function remove($username, $repository, $issue, $label) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels/'.rawurlencode($label)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels/'.rawurlencode($label)); } /** @@ -162,6 +162,6 @@ public function remove($username, $repository, $issue, $label) */ public function clear($username, $repository, $issue) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels'); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels'); } } diff --git a/lib/Github/Api/Issue/Milestones.php b/lib/Github/Api/Issue/Milestones.php index 55ba6fed998..87563da7abc 100644 --- a/lib/Github/Api/Issue/Milestones.php +++ b/lib/Github/Api/Issue/Milestones.php @@ -33,7 +33,7 @@ public function all($username, $repository, array $params = array()) $params['direction'] = 'desc'; } - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', array_merge(array( + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', array_merge(array( 'page' => 1, 'state' => 'open', 'sort' => 'due_date', @@ -53,7 +53,7 @@ public function all($username, $repository, array $params = array()) */ public function show($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id)); } /** @@ -77,7 +77,7 @@ public function create($username, $repository, array $params) $params['state'] = 'open'; } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', $params); } /** @@ -97,7 +97,7 @@ public function update($username, $repository, $id, array $params) $params['state'] = 'open'; } - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id), $params); } /** @@ -112,7 +112,7 @@ public function update($username, $repository, $id, array $params) */ public function remove($username, $repository, $id) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id)); } /** @@ -127,6 +127,6 @@ public function remove($username, $repository, $id) */ public function labels($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id).'/labels'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id).'/labels'); } } diff --git a/lib/Github/Api/Markdown.php b/lib/Github/Api/Markdown.php index f97a142df5f..82d2ac55b6c 100644 --- a/lib/Github/Api/Markdown.php +++ b/lib/Github/Api/Markdown.php @@ -31,7 +31,7 @@ public function render($text, $mode = 'markdown', $context = null) $params['context'] = $context; } - return $this->post('markdown', $params); + return $this->post('/markdown', $params); } /** @@ -41,7 +41,7 @@ public function render($text, $mode = 'markdown', $context = null) */ public function renderRaw($file) { - return $this->post('markdown/raw', array( + return $this->post('/markdown/raw', array( 'file' => $file )); } diff --git a/lib/Github/Api/Meta.php b/lib/Github/Api/Meta.php index fa3668af98a..076b3dc501e 100644 --- a/lib/Github/Api/Meta.php +++ b/lib/Github/Api/Meta.php @@ -17,6 +17,6 @@ class Meta extends AbstractApi */ public function service() { - return $this->get('meta'); + return $this->get('/meta'); } } diff --git a/lib/Github/Api/Notification.php b/lib/Github/Api/Notification.php index a2ed530ad28..d7a1be66555 100644 --- a/lib/Github/Api/Notification.php +++ b/lib/Github/Api/Notification.php @@ -36,7 +36,7 @@ public function all($includingRead = false, $participating = false, DateTime $si $parameters['since'] = $since->format(DateTime::ISO8601); } - return $this->get('notifications', $parameters); + return $this->get('/notifications', $parameters); } /** @@ -55,6 +55,6 @@ public function markRead(DateTime $since = null) $parameters['last_read_at'] = $since->format(DateTime::ISO8601); } - $this->put('notifications', $parameters); + $this->put('/notifications', $parameters); } } diff --git a/lib/Github/Api/Organization.php b/lib/Github/Api/Organization.php index 3f0321aefe5..71f948dcb0b 100644 --- a/lib/Github/Api/Organization.php +++ b/lib/Github/Api/Organization.php @@ -22,7 +22,7 @@ class Organization extends AbstractApi */ public function all($since = '') { - return $this->get('organizations?since='.rawurlencode($since)); + return $this->get('/organizations?since='.rawurlencode($since)); } /** @@ -36,12 +36,12 @@ public function all($since = '') */ public function show($organization) { - return $this->get('orgs/'.rawurlencode($organization)); + return $this->get('/orgs/'.rawurlencode($organization)); } public function update($organization, array $params) { - return $this->patch('orgs/'.rawurlencode($organization), $params); + return $this->patch('/orgs/'.rawurlencode($organization), $params); } /** @@ -56,7 +56,7 @@ public function update($organization, array $params) */ public function repositories($organization, $type = 'all') { - return $this->get('orgs/'.rawurlencode($organization).'/repos', array( + return $this->get('/orgs/'.rawurlencode($organization).'/repos', array( 'type' => $type )); } @@ -96,6 +96,6 @@ public function teams() */ public function issues($organization, array $params = array(), $page = 1) { - return $this->get('orgs/'.rawurlencode($organization).'/issues', array_merge(array('page' => $page), $params)); + return $this->get('/orgs/'.rawurlencode($organization).'/issues', array_merge(array('page' => $page), $params)); } } diff --git a/lib/Github/Api/Organization/Hooks.php b/lib/Github/Api/Organization/Hooks.php index 109b7b3b6d6..e137dee1ab7 100644 --- a/lib/Github/Api/Organization/Hooks.php +++ b/lib/Github/Api/Organization/Hooks.php @@ -16,7 +16,7 @@ class Hooks extends AbstractApi */ public function all($organization) { - return $this->get('orgs/'.rawurlencode($organization).'/hooks'); + return $this->get('/orgs/'.rawurlencode($organization).'/hooks'); } /** @@ -29,7 +29,7 @@ public function all($organization) */ public function show($organization, $id) { - return $this->get('orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id)); + return $this->get('/orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id)); } /** @@ -47,7 +47,7 @@ public function create($organization, array $params) throw new MissingArgumentException(array('name', 'config')); } - return $this->post('orgs/'.rawurlencode($organization).'/hooks', $params); + return $this->post('/orgs/'.rawurlencode($organization).'/hooks', $params); } /** @@ -66,7 +66,7 @@ public function update($organization, $id, array $params) throw new MissingArgumentException(array('config')); } - return $this->patch('orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id), $params); + return $this->patch('/orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id), $params); } /** @@ -79,7 +79,7 @@ public function update($organization, $id, array $params) */ public function ping($organization, $id) { - return $this->post('orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id).'/pings'); + return $this->post('/orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id).'/pings'); } /** @@ -92,6 +92,6 @@ public function ping($organization, $id) */ public function remove($organization, $id) { - return $this->delete('orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id)); + return $this->delete('/orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id)); } } diff --git a/lib/Github/Api/Organization/Members.php b/lib/Github/Api/Organization/Members.php index 72bb635c2dd..a3d466252ea 100644 --- a/lib/Github/Api/Organization/Members.php +++ b/lib/Github/Api/Organization/Members.php @@ -13,7 +13,7 @@ class Members extends AbstractApi public function all($organization, $type = null, $filter = 'all', $role = null) { $parameters = array(); - $path = 'orgs/'.rawurlencode($organization).'/'; + $path = '/orgs/'.rawurlencode($organization).'/'; if (null === $type) { $path .= 'members'; if (null !== $filter) { @@ -31,32 +31,32 @@ public function all($organization, $type = null, $filter = 'all', $role = null) public function show($organization, $username) { - return $this->get('orgs/'.rawurlencode($organization).'/members/'.rawurlencode($username)); + return $this->get('/orgs/'.rawurlencode($organization).'/members/'.rawurlencode($username)); } public function member($organization, $username) { - return $this->get('orgs/'.rawurlencode($organization).'/memberships/'.rawurlencode($username)); + return $this->get('/orgs/'.rawurlencode($organization).'/memberships/'.rawurlencode($username)); } public function check($organization, $username) { - return $this->get('orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username)); + return $this->get('/orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username)); } public function addMember($organization, $username) { - return $this->put('orgs/'.rawurlencode($organization).'/memberships/'.rawurlencode($username)); + return $this->put('/orgs/'.rawurlencode($organization).'/memberships/'.rawurlencode($username)); } public function publicize($organization, $username) { - return $this->put('orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username)); + return $this->put('/orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username)); } public function conceal($organization, $username) { - return $this->delete('orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username)); + return $this->delete('/orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username)); } /* @@ -64,11 +64,11 @@ public function conceal($organization, $username) */ public function add($organization, $username) { - return $this->put('orgs/'.rawurlencode($organization).'/memberships/'.rawurlencode($username)); + return $this->put('/orgs/'.rawurlencode($organization).'/memberships/'.rawurlencode($username)); } public function remove($organization, $username) { - return $this->delete('orgs/'.rawurlencode($organization).'/members/'.rawurlencode($username)); + return $this->delete('/orgs/'.rawurlencode($organization).'/members/'.rawurlencode($username)); } } diff --git a/lib/Github/Api/Organization/Teams.php b/lib/Github/Api/Organization/Teams.php index c90ee12af6e..b4aa52ecfe3 100644 --- a/lib/Github/Api/Organization/Teams.php +++ b/lib/Github/Api/Organization/Teams.php @@ -13,7 +13,7 @@ class Teams extends AbstractApi { public function all($organization) { - return $this->get('orgs/'.rawurlencode($organization).'/teams'); + return $this->get('/orgs/'.rawurlencode($organization).'/teams'); } public function create($organization, array $params) @@ -28,12 +28,12 @@ public function create($organization, array $params) $params['permission'] = 'pull'; } - return $this->post('orgs/'.rawurlencode($organization).'/teams', $params); + return $this->post('/orgs/'.rawurlencode($organization).'/teams', $params); } public function show($team) { - return $this->get('teams/'.rawurlencode($team)); + return $this->get('/teams/'.rawurlencode($team)); } public function update($team, array $params) @@ -45,42 +45,42 @@ public function update($team, array $params) $params['permission'] = 'pull'; } - return $this->patch('teams/'.rawurlencode($team), $params); + return $this->patch('/teams/'.rawurlencode($team), $params); } public function remove($team) { - return $this->delete('teams/'.rawurlencode($team)); + return $this->delete('/teams/'.rawurlencode($team)); } public function members($team) { - return $this->get('teams/'.rawurlencode($team).'/members'); + return $this->get('/teams/'.rawurlencode($team).'/members'); } public function check($team, $username) { - return $this->get('teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username)); + return $this->get('/teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username)); } public function addMember($team, $username) { - return $this->put('teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username)); + return $this->put('/teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username)); } public function removeMember($team, $username) { - return $this->delete('teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username)); + return $this->delete('/teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username)); } public function repositories($team) { - return $this->get('teams/'.rawurlencode($team).'/repos'); + return $this->get('/teams/'.rawurlencode($team).'/repos'); } public function repository($team, $username, $repository) { - return $this->get('teams/'.rawurlencode($team).'/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); + return $this->get('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); } public function addRepository($team, $username, $repository, $params = array()) @@ -89,11 +89,11 @@ public function addRepository($team, $username, $repository, $params = array()) $params['permission'] = 'pull'; } - return $this->put('teams/'.rawurlencode($team).'/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); + return $this->put('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); } public function removeRepository($team, $username, $repository) { - return $this->delete('teams/'.rawurlencode($team).'/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); + return $this->delete('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); } } diff --git a/lib/Github/Api/PullRequest.php b/lib/Github/Api/PullRequest.php index 6e3028faf53..5419ded7db9 100644 --- a/lib/Github/Api/PullRequest.php +++ b/lib/Github/Api/PullRequest.php @@ -31,7 +31,7 @@ public function all($username, $repository, array $params = array()) 'per_page' => 30 ), $params); - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $parameters); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $parameters); } /** @@ -47,17 +47,17 @@ public function all($username, $repository, array $params = array()) */ public function show($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id)); } public function commits($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/commits'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/commits'); } public function files($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/files'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/files'); } public function comments() @@ -98,7 +98,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('issue', 'body')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $params); } public function update($username, $repository, $id, array $params) @@ -107,12 +107,12 @@ public function update($username, $repository, $id, array $params) $params['state'] = 'open'; } - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id), $params); } public function merged($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/merge'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/merge'); } public function merge($username, $repository, $id, $message, $sha, $squash = false, $title = null) @@ -127,6 +127,6 @@ public function merge($username, $repository, $id, $message, $sha, $squash = fal $params['commit_title'] = $title; } - return $this->put('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/merge', $params); + return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/merge', $params); } } diff --git a/lib/Github/Api/PullRequest/Comments.php b/lib/Github/Api/PullRequest/Comments.php index dec30fb0566..971f38cee9e 100644 --- a/lib/Github/Api/PullRequest/Comments.php +++ b/lib/Github/Api/PullRequest/Comments.php @@ -13,12 +13,12 @@ class Comments extends AbstractApi { public function all($username, $repository, $pullRequest) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments'); } public function show($username, $repository, $comment) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment)); } public function create($username, $repository, $pullRequest, array $params) @@ -32,7 +32,7 @@ public function create($username, $repository, $pullRequest, array $params) throw new MissingArgumentException(array('commit_id', 'path', 'position')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments', $params); } public function update($username, $repository, $comment, array $params) @@ -41,11 +41,11 @@ public function update($username, $repository, $comment, array $params) throw new MissingArgumentException('body'); } - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment), $params); } public function remove($username, $repository, $comment) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment)); } } diff --git a/lib/Github/Api/RateLimit.php b/lib/Github/Api/RateLimit.php index a07eb781a6e..bfa42ae8288 100644 --- a/lib/Github/Api/RateLimit.php +++ b/lib/Github/Api/RateLimit.php @@ -17,7 +17,7 @@ class RateLimit extends AbstractApi */ public function getRateLimits() { - return $this->get('rate_limit'); + return $this->get('/rate_limit'); } /** @@ -28,7 +28,7 @@ public function getRateLimits() public function getCoreLimit() { $response = $this->getRateLimits(); - + return $response['resources']['core']['limit']; } @@ -40,7 +40,7 @@ public function getCoreLimit() public function getSearchLimit() { $response = $this->getRateLimits(); - + return $response['resources']['search']['limit']; } } diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index 755c23bb91c..1a416cf81d5 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -37,7 +37,7 @@ class Repo extends AbstractApi */ public function find($keyword, array $params = array()) { - return $this->get('legacy/repos/search/'.rawurlencode($keyword), array_merge(array('start_page' => 1), $params)); + return $this->get('/legacy/repos/search/'.rawurlencode($keyword), array_merge(array('start_page' => 1), $params)); } /** @@ -52,10 +52,10 @@ public function find($keyword, array $params = array()) public function all($id = null) { if (!is_int($id)) { - return $this->get('repositories'); + return $this->get('/repositories'); } - return $this->get('repositories?since=' . rawurldecode($id)); + return $this->get('/repositories?since=' . rawurldecode($id)); } /** @@ -70,7 +70,7 @@ public function all($id = null) */ public function activity($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/commit_activity'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/commit_activity'); } /** @@ -85,7 +85,7 @@ public function activity($username, $repository) */ public function statistics($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/contributors'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/contributors'); } /** @@ -100,7 +100,7 @@ public function statistics($username, $repository) */ public function org($organization, array $params = array()) { - return $this->get('orgs/'.$organization.'/repos', array_merge(array('start_page' => 1), $params)); + return $this->get('/orgs/'.$organization.'/repos', array_merge(array('start_page' => 1), $params)); } /** @@ -115,7 +115,7 @@ public function org($organization, array $params = array()) */ public function show($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); } /** @@ -148,7 +148,7 @@ public function create( $teamId = null, $autoInit = false ) { - $path = null !== $organization ? 'orgs/'.$organization.'/repos' : 'user/repos'; + $path = null !== $organization ? '/orgs/'.$organization.'/repos' : '/user/repos'; $parameters = array( 'name' => $name, @@ -181,7 +181,7 @@ public function create( */ public function update($username, $repository, array $values) { - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository), $values); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository), $values); } /** @@ -196,7 +196,7 @@ public function update($username, $repository, array $values) */ public function remove($username, $repository) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); } /** @@ -211,7 +211,7 @@ public function remove($username, $repository) */ public function readme($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme'); } /** @@ -371,7 +371,7 @@ public function statuses() */ public function branches($username, $repository, $branch = null) { - $url = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches'; + $url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches'; if (null !== $branch) { $url .= '/'.rawurlencode($branch); } @@ -393,7 +393,7 @@ public function branches($username, $repository, $branch = null) */ public function contributors($username, $repository, $includingAnonymous = false) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contributors', array( + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contributors', array( 'anon' => $includingAnonymous ?: null )); } @@ -410,7 +410,7 @@ public function contributors($username, $repository, $includingAnonymous = false */ public function languages($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/languages'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/languages'); } /** @@ -426,7 +426,7 @@ public function languages($username, $repository) */ public function tags($username, $repository, array $params = []) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/tags', $params); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/tags', $params); } /** @@ -441,7 +441,7 @@ public function tags($username, $repository, array $params = []) */ public function teams($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/teams'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/teams'); } /** @@ -455,7 +455,7 @@ public function teams($username, $repository) */ public function watchers($username, $repository, $page = 1) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/watchers', array( + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/watchers', array( 'page' => $page )); } @@ -469,7 +469,7 @@ public function watchers($username, $repository, $page = 1) */ public function subscribers($username, $repository, $page = 1) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/subscribers', array( + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/subscribers', array( 'page' => $page )); } @@ -498,7 +498,7 @@ public function merge($username, $repository, $base, $head, $message = null) $parameters['commit_message'] = $message; } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/merges', $parameters); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/merges', $parameters); } /** @@ -508,6 +508,6 @@ public function merge($username, $repository, $base, $head, $message = null) */ public function milestones($username, $repository) { - return $this->get('repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/milestones'); + return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/milestones'); } } diff --git a/lib/Github/Api/Repository/Assets.php b/lib/Github/Api/Repository/Assets.php index 7fa7a1dddfc..21b5a08cc5d 100644 --- a/lib/Github/Api/Repository/Assets.php +++ b/lib/Github/Api/Repository/Assets.php @@ -24,7 +24,7 @@ class Assets extends AbstractApi */ public function all($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id).'/assets'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id).'/assets'); } /** @@ -39,7 +39,7 @@ public function all($username, $repository, $id) */ public function show($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id)); } /** @@ -97,7 +97,7 @@ public function edit($username, $repository, $id, array $params) throw new MissingArgumentException('name'); } - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id), $params); } /** @@ -112,6 +112,6 @@ public function edit($username, $repository, $id, array $params) */ public function remove($username, $repository, $id) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id)); } } diff --git a/lib/Github/Api/Repository/Collaborators.php b/lib/Github/Api/Repository/Collaborators.php index 89a95068559..116d8cc5a38 100644 --- a/lib/Github/Api/Repository/Collaborators.php +++ b/lib/Github/Api/Repository/Collaborators.php @@ -12,21 +12,21 @@ class Collaborators extends AbstractApi { public function all($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators'); } public function check($username, $repository, $collaborator) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); } public function add($username, $repository, $collaborator) { - return $this->put('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); + return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); } public function remove($username, $repository, $collaborator) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); } } diff --git a/lib/Github/Api/Repository/Commits.php b/lib/Github/Api/Repository/Commits.php index d8d45c73cd3..3aaa460d6c2 100644 --- a/lib/Github/Api/Repository/Commits.php +++ b/lib/Github/Api/Repository/Commits.php @@ -12,7 +12,7 @@ class Commits extends AbstractApi { public function all($username, $repository, array $params) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits', $params); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits', $params); } public function compare($username, $repository, $base, $head, $mediaType = null) @@ -22,11 +22,11 @@ public function compare($username, $repository, $base, $head, $mediaType = null) $headers['Accept'] = $mediaType; } - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/compare/'.rawurlencode($base).'...'.rawurlencode($head), array(), $headers); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/compare/'.rawurlencode($base).'...'.rawurlencode($head), array(), $headers); } public function show($username, $repository, $sha) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha)); } } diff --git a/lib/Github/Api/Repository/Contents.php b/lib/Github/Api/Repository/Contents.php index 450c14b5845..064f68490ff 100644 --- a/lib/Github/Api/Repository/Contents.php +++ b/lib/Github/Api/Repository/Contents.php @@ -27,7 +27,7 @@ class Contents extends AbstractApi */ public function readme($username, $repository, $reference = null) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', array( + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', array( 'ref' => $reference )); } @@ -46,7 +46,7 @@ public function readme($username, $repository, $reference = null) */ public function show($username, $repository, $path = null, $reference = null) { - $url = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents'; + $url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents'; if (null !== $path) { $url .= '/'.rawurlencode($path); } @@ -75,7 +75,7 @@ public function show($username, $repository, $path = null, $reference = null) */ public function create($username, $repository, $path, $content, $message, $branch = null, array $committer = null) { - $url = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path); + $url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path); $parameters = array( 'content' => base64_encode($content), @@ -108,7 +108,7 @@ public function create($username, $repository, $path, $content, $message, $branc */ public function exists($username, $repository, $path, $reference = null) { - $url = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents'; + $url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents'; if (null !== $path) { $url .= '/'.rawurlencode($path); @@ -151,7 +151,7 @@ public function exists($username, $repository, $path, $reference = null) */ public function update($username, $repository, $path, $content, $message, $sha, $branch = null, array $committer = null) { - $url = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path); + $url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path); $parameters = array( 'content' => base64_encode($content), @@ -192,7 +192,7 @@ public function update($username, $repository, $path, $content, $message, $sha, */ public function rm($username, $repository, $path, $message, $sha, $branch = null, array $committer = null) { - $url = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path); + $url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path); $parameters = array( 'message' => $message, @@ -231,7 +231,7 @@ public function archive($username, $repository, $format, $reference = null) $format = 'tarball'; } - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($format). + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($format). ((null !== $reference) ? ('/'.rawurlencode($reference)) : '')); } diff --git a/lib/Github/Api/Repository/DeployKeys.php b/lib/Github/Api/Repository/DeployKeys.php index 390835798ac..2c25542dfc3 100644 --- a/lib/Github/Api/Repository/DeployKeys.php +++ b/lib/Github/Api/Repository/DeployKeys.php @@ -13,12 +13,12 @@ class DeployKeys extends AbstractApi { public function all($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys'); } public function show($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id)); } public function create($username, $repository, array $params) @@ -27,7 +27,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('title', 'key')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys', $params); } public function update($username, $repository, $id, array $params) @@ -36,11 +36,11 @@ public function update($username, $repository, $id, array $params) throw new MissingArgumentException(array('title', 'key')); } - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id), $params); } public function remove($username, $repository, $id) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id)); } } diff --git a/lib/Github/Api/Repository/Downloads.php b/lib/Github/Api/Repository/Downloads.php index 63177e49903..bfde5b3ea5e 100644 --- a/lib/Github/Api/Repository/Downloads.php +++ b/lib/Github/Api/Repository/Downloads.php @@ -22,7 +22,7 @@ class Downloads extends AbstractApi */ public function all($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads'); } /** @@ -38,7 +38,7 @@ public function all($username, $repository) */ public function show($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads/'.rawurlencode($id)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads/'.rawurlencode($id)); } /** @@ -54,6 +54,6 @@ public function show($username, $repository, $id) */ public function remove($username, $repository, $id) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads/'.rawurlencode($id)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads/'.rawurlencode($id)); } } diff --git a/lib/Github/Api/Repository/Forks.php b/lib/Github/Api/Repository/Forks.php index c165961856e..dbd4f3d3785 100644 --- a/lib/Github/Api/Repository/Forks.php +++ b/lib/Github/Api/Repository/Forks.php @@ -16,11 +16,11 @@ public function all($username, $repository, array $params = array()) $params['sort'] = 'newest'; } - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/forks', array_merge(array('page' => 1), $params)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/forks', array_merge(array('page' => 1), $params)); } public function create($username, $repository, array $params = array()) { - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/forks', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/forks', $params); } } diff --git a/lib/Github/Api/Repository/Hooks.php b/lib/Github/Api/Repository/Hooks.php index 55940ea5009..30f887d726f 100644 --- a/lib/Github/Api/Repository/Hooks.php +++ b/lib/Github/Api/Repository/Hooks.php @@ -13,12 +13,12 @@ class Hooks extends AbstractApi { public function all($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks'); } public function show($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id)); } public function create($username, $repository, array $params) @@ -27,7 +27,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('name', 'config')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks', $params); } public function update($username, $repository, $id, array $params) @@ -36,21 +36,21 @@ public function update($username, $repository, $id, array $params) throw new MissingArgumentException(array('name', 'config')); } - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id), $params); } public function ping($username, $repository, $id) { - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id).'/pings'); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id).'/pings'); } public function test($username, $repository, $id) { - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id).'/test'); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id).'/test'); } public function remove($username, $repository, $id) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id)); } } diff --git a/lib/Github/Api/Repository/Labels.php b/lib/Github/Api/Repository/Labels.php index e35b4ded71d..34535e8e1c9 100644 --- a/lib/Github/Api/Repository/Labels.php +++ b/lib/Github/Api/Repository/Labels.php @@ -13,12 +13,12 @@ class Labels extends AbstractApi { public function all($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels'); } public function show($username, $repository, $label) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label)); } public function create($username, $repository, array $params) @@ -27,7 +27,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('name', 'color')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels', $params); } public function update($username, $repository, $label, array $params) @@ -36,11 +36,11 @@ public function update($username, $repository, $label, array $params) throw new MissingArgumentException(array('name', 'color')); } - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label), $params); } public function remove($username, $repository, $label) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label)); } } diff --git a/lib/Github/Api/Repository/Releases.php b/lib/Github/Api/Repository/Releases.php index e25b1e7ef84..4d59318fe07 100644 --- a/lib/Github/Api/Repository/Releases.php +++ b/lib/Github/Api/Repository/Releases.php @@ -22,7 +22,7 @@ class Releases extends AbstractApi */ public function latest($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/latest'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/latest'); } /** @@ -36,7 +36,7 @@ public function latest($username, $repository) */ public function tag($username, $repository, $tag) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/tags/'.rawurlencode($tag)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/tags/'.rawurlencode($tag)); } /** @@ -50,7 +50,7 @@ public function tag($username, $repository, $tag) */ public function all($username, $repository, array $params = []) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases', $params); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases', $params); } /** @@ -64,7 +64,7 @@ public function all($username, $repository, array $params = []) */ public function show($username, $repository, $id) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id)); } /** @@ -84,7 +84,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException('tag_name'); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases', $params); } /** @@ -99,7 +99,7 @@ public function create($username, $repository, array $params) */ public function edit($username, $repository, $id, array $params) { - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id), $params); } /** @@ -113,7 +113,7 @@ public function edit($username, $repository, $id, array $params) */ public function remove($username, $repository, $id) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id)); } /** diff --git a/lib/Github/Api/Repository/Statuses.php b/lib/Github/Api/Repository/Statuses.php index caab1e2b524..728d1305f28 100644 --- a/lib/Github/Api/Repository/Statuses.php +++ b/lib/Github/Api/Repository/Statuses.php @@ -22,7 +22,7 @@ class Statuses extends AbstractApi */ public function show($username, $repository, $sha) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/statuses'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/statuses'); } /** @@ -36,7 +36,7 @@ public function show($username, $repository, $sha) */ public function combined($username, $repository, $sha) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/status'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/status'); } /** @@ -57,6 +57,6 @@ public function create($username, $repository, $sha, array $params = array()) throw new MissingArgumentException('state'); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/statuses/'.rawurlencode($sha), $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/statuses/'.rawurlencode($sha), $params); } } diff --git a/lib/Github/Api/Search.php b/lib/Github/Api/Search.php index 6ca29ea62b7..15e698ac970 100644 --- a/lib/Github/Api/Search.php +++ b/lib/Github/Api/Search.php @@ -23,7 +23,7 @@ class Search extends AbstractApi */ public function repositories($q, $sort = 'updated', $order = 'desc') { - return $this->get('search/repositories', array('q' => $q, 'sort' => $sort, 'order' => $order)); + return $this->get('/search/repositories', array('q' => $q, 'sort' => $sort, 'order' => $order)); } /** @@ -39,7 +39,7 @@ public function repositories($q, $sort = 'updated', $order = 'desc') */ public function issues($q, $sort = 'updated', $order = 'desc') { - return $this->get('search/issues', array('q' => $q, 'sort' => $sort, 'order' => $order)); + return $this->get('/search/issues', array('q' => $q, 'sort' => $sort, 'order' => $order)); } /** @@ -55,7 +55,7 @@ public function issues($q, $sort = 'updated', $order = 'desc') */ public function code($q, $sort = 'updated', $order = 'desc') { - return $this->get('search/code', array('q' => $q, 'sort' => $sort, 'order' => $order)); + return $this->get('/search/code', array('q' => $q, 'sort' => $sort, 'order' => $order)); } /** @@ -71,6 +71,6 @@ public function code($q, $sort = 'updated', $order = 'desc') */ public function users($q, $sort = 'updated', $order = 'desc') { - return $this->get('search/users', array('q' => $q, 'sort' => $sort, 'order' => $order)); + return $this->get('/search/users', array('q' => $q, 'sort' => $sort, 'order' => $order)); } } diff --git a/lib/Github/Api/User.php b/lib/Github/Api/User.php index dd5ee1b2737..d866c93050b 100644 --- a/lib/Github/Api/User.php +++ b/lib/Github/Api/User.php @@ -22,7 +22,7 @@ class User extends AbstractApi */ public function find($keyword) { - return $this->get('legacy/user/search/'.rawurlencode($keyword)); + return $this->get('/legacy/user/search/'.rawurlencode($keyword)); } /** @@ -37,10 +37,10 @@ public function find($keyword) public function all($id = null) { if (!is_int($id)) { - return $this->get('users'); + return $this->get('/users'); } - return $this->get('users?since=' . rawurldecode($id)); + return $this->get('/users?since=' . rawurldecode($id)); } /** @@ -54,7 +54,7 @@ public function all($id = null) */ public function show($username) { - return $this->get('users/'.rawurlencode($username)); + return $this->get('/users/'.rawurlencode($username)); } /** @@ -68,7 +68,7 @@ public function show($username) */ public function organizations($username) { - return $this->get('users/'.rawurlencode($username).'/orgs'); + return $this->get('/users/'.rawurlencode($username).'/orgs'); } /** @@ -82,7 +82,7 @@ public function organizations($username) */ public function following($username) { - return $this->get('users/'.rawurlencode($username).'/following'); + return $this->get('/users/'.rawurlencode($username).'/following'); } /** @@ -96,7 +96,7 @@ public function following($username) */ public function followers($username) { - return $this->get('users/'.rawurlencode($username).'/followers'); + return $this->get('/users/'.rawurlencode($username).'/followers'); } /** @@ -110,7 +110,7 @@ public function followers($username) */ public function watched($username) { - return $this->get('users/'.rawurlencode($username).'/watched'); + return $this->get('/users/'.rawurlencode($username).'/watched'); } /** @@ -125,7 +125,7 @@ public function watched($username) */ public function starred($username, $page = 1) { - return $this->get('users/'.rawurlencode($username).'/starred', array( + return $this->get('/users/'.rawurlencode($username).'/starred', array( 'page' => $page )); } @@ -141,7 +141,7 @@ public function starred($username, $page = 1) */ public function subscriptions($username) { - return $this->get('users/'.rawurlencode($username).'/subscriptions'); + return $this->get('/users/'.rawurlencode($username).'/subscriptions'); } /** @@ -158,7 +158,7 @@ public function subscriptions($username) */ public function repositories($username, $type = 'owner', $sort = 'full_name', $direction = 'asc') { - return $this->get('users/'.rawurlencode($username).'/repos', array( + return $this->get('/users/'.rawurlencode($username).'/repos', array( 'type' => $type, 'sort' => $sort, 'direction' => $direction @@ -176,7 +176,7 @@ public function repositories($username, $type = 'owner', $sort = 'full_name', $d */ public function gists($username) { - return $this->get('users/'.rawurlencode($username).'/gists'); + return $this->get('/users/'.rawurlencode($username).'/gists'); } /** @@ -190,7 +190,7 @@ public function gists($username) */ public function keys($username) { - return $this->get('users/'.rawurlencode($username).'/keys'); + return $this->get('/users/'.rawurlencode($username).'/keys'); } /** @@ -204,6 +204,6 @@ public function keys($username) */ public function publicEvents($username) { - return $this->get('users/'.rawurlencode($username) . '/events/public'); + return $this->get('/users/'.rawurlencode($username) . '/events/public'); } } diff --git a/lib/Github/Client.php b/lib/Github/Client.php index 582351505c9..3ec9f9bf82e 100644 --- a/lib/Github/Client.php +++ b/lib/Github/Client.php @@ -154,7 +154,7 @@ public function __construct(HttpClient $httpClient = null, $apiVersion = null, $ $this->addPlugin(new GithubExceptionThrower()); $this->addPlugin(new Plugin\HistoryPlugin($this->responseHistory)); $this->addPlugin(new Plugin\RedirectPlugin()); - $this->addPlugin(new Plugin\AddHostPlugin(UriFactoryDiscovery::find()->createUri('https://api.github.com/'))); + $this->addPlugin(new Plugin\AddHostPlugin(UriFactoryDiscovery::find()->createUri('https://api.github.com'))); $this->addPlugin(new Plugin\HeaderDefaultsPlugin(array( 'User-Agent' => 'php-github-api (http://github.com/KnpLabs/php-github-api)', ))); From 341f45739b4478deb2392b1ab5f70d81fe572684 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Tue, 2 Aug 2016 17:47:16 +0200 Subject: [PATCH 2/2] Fixed the tests --- lib/Github/Api/GitData/Blobs.php | 4 +- lib/Github/Api/Issue/Comments.php | 10 ++--- lib/Github/Api/Repository/Comments.php | 12 +++--- lib/Github/Api/Repository/Stargazers.php | 2 +- test/Github/Tests/Api/AuthorizationsTest.php | 18 ++++---- .../Tests/Api/CurrentUser/DeployKeysTest.php | 10 ++--- .../Tests/Api/CurrentUser/EmailsTest.php | 10 ++--- .../Tests/Api/CurrentUser/FollowersTest.php | 8 ++-- .../Tests/Api/CurrentUser/MembershipsTest.php | 6 +-- .../Tests/Api/CurrentUser/StarringTest.php | 8 ++-- .../Tests/Api/CurrentUser/WatchersTest.php | 8 ++-- test/Github/Tests/Api/CurrentUserTest.php | 10 ++--- test/Github/Tests/Api/DeploymentTest.php | 10 ++--- .../Tests/Api/Enterprise/LicenseTest.php | 2 +- .../Github/Tests/Api/Enterprise/StatsTest.php | 4 +- .../Tests/Api/Enterprise/UserAdminTest.php | 4 +- test/Github/Tests/Api/Gist/CommentsTest.php | 10 ++--- test/Github/Tests/Api/GistsTest.php | 24 +++++------ test/Github/Tests/Api/GitData/BlobsTest.php | 6 +-- test/Github/Tests/Api/GitData/CommitsTest.php | 4 +- .../Tests/Api/GitData/ReferencesTest.php | 16 +++---- test/Github/Tests/Api/GitData/TagsTest.php | 6 +-- test/Github/Tests/Api/GitData/TreesTest.php | 6 +-- test/Github/Tests/Api/Issue/CommentsTest.php | 10 ++--- test/Github/Tests/Api/Issue/EventsTest.php | 6 +-- test/Github/Tests/Api/Issue/LabelsTest.php | 22 +++++----- .../Github/Tests/Api/Issue/MilestonesTest.php | 24 +++++------ test/Github/Tests/Api/IssueTest.php | 18 ++++---- test/Github/Tests/Api/MarkdownTest.php | 12 +++--- test/Github/Tests/Api/NotificationTest.php | 10 ++--- .../Tests/Api/Organization/HooksTest.php | 12 +++--- .../Tests/Api/Organization/MembersTest.php | 16 +++---- .../Tests/Api/Organization/TeamsTest.php | 32 +++++++------- test/Github/Tests/Api/OrganizationTest.php | 8 ++-- test/Github/Tests/Api/PullRequestTest.php | 22 +++++----- test/Github/Tests/Api/RateLimitTest.php | 2 +- test/Github/Tests/Api/RepoTest.php | 42 +++++++++---------- .../Tests/Api/Repository/AssetsTest.php | 8 ++-- .../Api/Repository/CollaboratorsTest.php | 8 ++-- .../Tests/Api/Repository/CommentsTest.php | 14 +++---- .../Tests/Api/Repository/CommitsTest.php | 6 +-- .../Tests/Api/Repository/ContentsTest.php | 28 ++++++------- .../Tests/Api/Repository/DeployKeysTest.php | 10 ++--- .../Tests/Api/Repository/DownloadsTest.php | 6 +-- .../Github/Tests/Api/Repository/ForksTest.php | 6 +-- .../Github/Tests/Api/Repository/HooksTest.php | 12 +++--- .../Tests/Api/Repository/LabelsTest.php | 10 ++--- .../Tests/Api/Repository/ReleasesTest.php | 14 +++---- .../Tests/Api/Repository/StargazersTest.php | 4 +- .../Tests/Api/Repository/StatusesTest.php | 6 +-- test/Github/Tests/Api/SearchTest.php | 16 +++---- test/Github/Tests/Api/UserTest.php | 18 ++++---- 52 files changed, 300 insertions(+), 300 deletions(-) diff --git a/lib/Github/Api/GitData/Blobs.php b/lib/Github/Api/GitData/Blobs.php index a5ebfd627bb..b8abb415193 100644 --- a/lib/Github/Api/GitData/Blobs.php +++ b/lib/Github/Api/GitData/Blobs.php @@ -38,7 +38,7 @@ public function configure($bodyType = null) */ public function show($username, $repository, $sha) { - $response = $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs/'.rawurlencode($sha)); + $response = $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs/'.rawurlencode($sha)); return $response; } @@ -60,6 +60,6 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('content', 'encoding')); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs', $params); } } diff --git a/lib/Github/Api/Issue/Comments.php b/lib/Github/Api/Issue/Comments.php index f1d19515718..e72b964f02e 100644 --- a/lib/Github/Api/Issue/Comments.php +++ b/lib/Github/Api/Issue/Comments.php @@ -43,7 +43,7 @@ public function configure($bodyType = null) */ public function all($username, $repository, $issue, $page = 1) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/comments', array( + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/comments', array( 'page' => $page )); } @@ -60,7 +60,7 @@ public function all($username, $repository, $issue, $page = 1) */ public function show($username, $repository, $comment) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment)); } /** @@ -81,7 +81,7 @@ public function create($username, $repository, $issue, array $params) throw new MissingArgumentException('body'); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/comments', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/comments', $params); } /** @@ -102,7 +102,7 @@ public function update($username, $repository, $comment, array $params) throw new MissingArgumentException('body'); } - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment), $params); } /** @@ -117,6 +117,6 @@ public function update($username, $repository, $comment, array $params) */ public function remove($username, $repository, $comment) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment)); } } diff --git a/lib/Github/Api/Repository/Comments.php b/lib/Github/Api/Repository/Comments.php index f9d2a54af2b..b1d9abe7cbe 100644 --- a/lib/Github/Api/Repository/Comments.php +++ b/lib/Github/Api/Repository/Comments.php @@ -40,15 +40,15 @@ public function configure($bodyType = null) public function all($username, $repository, $sha = null) { if (null === $sha) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments'); } - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/comments'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/comments'); } public function show($username, $repository, $comment) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment)); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment)); } public function create($username, $repository, $sha, array $params) @@ -57,7 +57,7 @@ public function create($username, $repository, $sha, array $params) throw new MissingArgumentException('body'); } - return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/comments', $params); + return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/comments', $params); } public function update($username, $repository, $comment, array $params) @@ -66,11 +66,11 @@ public function update($username, $repository, $comment, array $params) throw new MissingArgumentException('body'); } - return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment), $params); + return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment), $params); } public function remove($username, $repository, $comment) { - return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment)); + return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment)); } } diff --git a/lib/Github/Api/Repository/Stargazers.php b/lib/Github/Api/Repository/Stargazers.php index 9b7a8470002..9267dff4fbd 100644 --- a/lib/Github/Api/Repository/Stargazers.php +++ b/lib/Github/Api/Repository/Stargazers.php @@ -30,6 +30,6 @@ public function configure($bodyType = null) public function all($username, $repository) { - return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stargazers'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stargazers'); } } diff --git a/test/Github/Tests/Api/AuthorizationsTest.php b/test/Github/Tests/Api/AuthorizationsTest.php index 059c2ffe7f8..d0570c79956 100644 --- a/test/Github/Tests/Api/AuthorizationsTest.php +++ b/test/Github/Tests/Api/AuthorizationsTest.php @@ -14,7 +14,7 @@ public function shouldGetAllAuthorizations() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('authorizations') + ->with('/authorizations') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->all()); @@ -31,7 +31,7 @@ public function shouldShowAuthorization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('authorizations/'.$id) + ->with('/authorizations/'.$id) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show($id)); @@ -49,7 +49,7 @@ public function shouldAuthorization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('authorizations', $input); + ->with('/authorizations', $input); $api->create($input); } @@ -67,7 +67,7 @@ public function shouldUpdateAuthorization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('authorizations/'.$id, $input); + ->with('/authorizations/'.$id, $input); $api->update($id, $input); } @@ -81,7 +81,7 @@ public function shouldDeleteAuthorization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('authorizations/'.$id); + ->with('/authorizations/'.$id); $api->remove($id); } @@ -98,7 +98,7 @@ public function shouldCheckAuthorization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('applications/'.$id.'/tokens/'.$token) + ->with('/applications/'.$id.'/tokens/'.$token) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->check($id, $token)); @@ -115,7 +115,7 @@ public function shouldResetAuthorization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('applications/'.$id.'/tokens/'.$token); + ->with('/applications/'.$id.'/tokens/'.$token); $api->reset($id, $token); } @@ -131,7 +131,7 @@ public function shouldRevokeAuthorization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('applications/'.$id.'/tokens/'.$token); + ->with('/applications/'.$id.'/tokens/'.$token); $api->revoke($id, $token); } @@ -146,7 +146,7 @@ public function shouldRevokeAllAuthorizations() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('applications/'.$id.'/tokens'); + ->with('/applications/'.$id.'/tokens'); $api->revokeAll($id); } diff --git a/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php b/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php index f813ca80673..f72d9405736 100644 --- a/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php +++ b/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php @@ -14,7 +14,7 @@ public function shouldShowKey() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/keys/12') + ->with('/user/keys/12') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show(12)); @@ -30,7 +30,7 @@ public function shouldGetKeys() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/keys') + ->with('/user/keys') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all()); @@ -47,7 +47,7 @@ public function shouldCreateKey() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('user/keys', $data) + ->with('/user/keys', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create($data)); @@ -94,7 +94,7 @@ public function shouldUpdateKey() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('user/keys/123', $data) + ->with('/user/keys/123', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update(123, $data)); @@ -140,7 +140,7 @@ public function shouldRemoveKey() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('user/keys/123') + ->with('/user/keys/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove(123)); diff --git a/test/Github/Tests/Api/CurrentUser/EmailsTest.php b/test/Github/Tests/Api/CurrentUser/EmailsTest.php index 33e1f704c7f..af8e90490da 100644 --- a/test/Github/Tests/Api/CurrentUser/EmailsTest.php +++ b/test/Github/Tests/Api/CurrentUser/EmailsTest.php @@ -14,7 +14,7 @@ public function shouldGetEmails() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/emails') + ->with('/user/emails') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all()); @@ -30,7 +30,7 @@ public function shouldRemoveEmail() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('user/emails', array('email@example.com')) + ->with('/user/emails', array('email@example.com')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('email@example.com')); @@ -46,7 +46,7 @@ public function shouldRemoveEmails() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('user/emails', array('email@example.com', 'email2@example.com')) + ->with('/user/emails', array('email@example.com', 'email2@example.com')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove(array('email@example.com', 'email2@example.com'))); @@ -75,7 +75,7 @@ public function shouldAddEmail() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('user/emails', array('email@example.com')) + ->with('/user/emails', array('email@example.com')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->add('email@example.com')); @@ -91,7 +91,7 @@ public function shouldAddEmails() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('user/emails', array('email@example.com', 'email2@example.com')) + ->with('/user/emails', array('email@example.com', 'email2@example.com')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->add(array('email@example.com', 'email2@example.com'))); diff --git a/test/Github/Tests/Api/CurrentUser/FollowersTest.php b/test/Github/Tests/Api/CurrentUser/FollowersTest.php index d2e74ec438b..4d1b1215634 100644 --- a/test/Github/Tests/Api/CurrentUser/FollowersTest.php +++ b/test/Github/Tests/Api/CurrentUser/FollowersTest.php @@ -17,7 +17,7 @@ public function shouldGetFollowers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/following') + ->with('/user/following') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all()); @@ -31,7 +31,7 @@ public function shouldCheckFollower() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/following/l3l0') + ->with('/user/following/l3l0') ->will($this->returnValue(null)); $this->assertNull($api->check('l3l0')); @@ -45,7 +45,7 @@ public function shouldFollowUser() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('user/following/l3l0') + ->with('/user/following/l3l0') ->will($this->returnValue(null)); $this->assertNull($api->follow('l3l0')); @@ -59,7 +59,7 @@ public function shouldUnfollowUser() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('user/following/l3l0') + ->with('/user/following/l3l0') ->will($this->returnValue(null)); $this->assertNull($api->unfollow('l3l0')); diff --git a/test/Github/Tests/Api/CurrentUser/MembershipsTest.php b/test/Github/Tests/Api/CurrentUser/MembershipsTest.php index 571f1bce41d..ef9f5c4d40c 100644 --- a/test/Github/Tests/Api/CurrentUser/MembershipsTest.php +++ b/test/Github/Tests/Api/CurrentUser/MembershipsTest.php @@ -35,7 +35,7 @@ public function shouldGetMemberships() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/memberships/orgs') + ->with('/user/memberships/orgs') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all()); @@ -60,7 +60,7 @@ public function shouldGetMembershipsForOrganization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/memberships/orgs/invitocat') + ->with('/user/memberships/orgs/invitocat') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->organization('invitocat')); @@ -78,7 +78,7 @@ public function shouldEditMembershipsForOrganization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('user/memberships/orgs/invitocat') + ->with('/user/memberships/orgs/invitocat') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->edit('invitocat')); diff --git a/test/Github/Tests/Api/CurrentUser/StarringTest.php b/test/Github/Tests/Api/CurrentUser/StarringTest.php index bc5943ee4e3..51242409c88 100644 --- a/test/Github/Tests/Api/CurrentUser/StarringTest.php +++ b/test/Github/Tests/Api/CurrentUser/StarringTest.php @@ -17,7 +17,7 @@ public function shouldGetStarred() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/starred') + ->with('/user/starred') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all()); @@ -31,7 +31,7 @@ public function shouldCheckStar() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/starred/l3l0/test') + ->with('/user/starred/l3l0/test') ->will($this->returnValue(null)); $this->assertNull($api->check('l3l0', 'test')); @@ -45,7 +45,7 @@ public function shouldStarUser() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('user/starred/l3l0/test') + ->with('/user/starred/l3l0/test') ->will($this->returnValue(null)); $this->assertNull($api->star('l3l0', 'test')); @@ -59,7 +59,7 @@ public function shouldUnstarUser() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('user/starred/l3l0/test') + ->with('/user/starred/l3l0/test') ->will($this->returnValue(null)); $this->assertNull($api->unstar('l3l0', 'test')); diff --git a/test/Github/Tests/Api/CurrentUser/WatchersTest.php b/test/Github/Tests/Api/CurrentUser/WatchersTest.php index c8383935b70..487cafad456 100644 --- a/test/Github/Tests/Api/CurrentUser/WatchersTest.php +++ b/test/Github/Tests/Api/CurrentUser/WatchersTest.php @@ -17,7 +17,7 @@ public function shouldGetWatchers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/subscriptions') + ->with('/user/subscriptions') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all()); @@ -31,7 +31,7 @@ public function shouldCheckWatcher() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/subscriptions/l3l0/test') + ->with('/user/subscriptions/l3l0/test') ->will($this->returnValue(null)); $this->assertNull($api->check('l3l0', 'test')); @@ -45,7 +45,7 @@ public function shouldWatchUser() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('user/subscriptions/l3l0/test') + ->with('/user/subscriptions/l3l0/test') ->will($this->returnValue(null)); $this->assertNull($api->watch('l3l0', 'test')); @@ -59,7 +59,7 @@ public function shouldUnwatchUser() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('user/subscriptions/l3l0/test') + ->with('/user/subscriptions/l3l0/test') ->will($this->returnValue(null)); $this->assertNull($api->unwatch('l3l0', 'test')); diff --git a/test/Github/Tests/Api/CurrentUserTest.php b/test/Github/Tests/Api/CurrentUserTest.php index f1dd27b0b77..cb447ff1b9c 100644 --- a/test/Github/Tests/Api/CurrentUserTest.php +++ b/test/Github/Tests/Api/CurrentUserTest.php @@ -14,7 +14,7 @@ public function shouldShowCurrentUser() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user') + ->with('/user') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show()); @@ -30,7 +30,7 @@ public function shouldUpdateCurrentUserData() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('user', array('value' => 'toChange')) + ->with('/user', array('value' => 'toChange')) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update(array('value' => 'toChange'))); @@ -46,7 +46,7 @@ public function shouldGetUserFollowers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/followers', array('page' => 1)) + ->with('/user/followers', array('page' => 1)) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->followers(1)); @@ -62,7 +62,7 @@ public function shouldGetIssuesAssignedToUser() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('issues', array('page' => 1, 'some' => 'param')) + ->with('/issues', array('page' => 1, 'some' => 'param')) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->issues(array('some' => 'param'))); @@ -78,7 +78,7 @@ public function shouldGetWatchedRepositories() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('user/watched', array('page' => 1)) + ->with('/user/watched', array('page' => 1)) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->watched(1)); diff --git a/test/Github/Tests/Api/DeploymentTest.php b/test/Github/Tests/Api/DeploymentTest.php index baa692e430b..996afcdc8be 100644 --- a/test/Github/Tests/Api/DeploymentTest.php +++ b/test/Github/Tests/Api/DeploymentTest.php @@ -13,7 +13,7 @@ public function shouldCreateDeployment() $deploymentData = array('ref' => 'fd6a5f9e5a430dddae8d6a8ea378f913d3a766f9'); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/deployments', $deploymentData); + ->with('/repos/KnpLabs/php-github-api/deployments', $deploymentData); $api->create('KnpLabs', 'php-github-api', $deploymentData); } @@ -26,7 +26,7 @@ public function shouldGetAllDeployments() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/deployments'); + ->with('/repos/KnpLabs/php-github-api/deployments'); $api->all('KnpLabs', 'php-github-api'); } @@ -41,7 +41,7 @@ public function shouldGetAllDeploymentsWithFilterParameters() $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/deployments', $filterData); + ->with('/repos/KnpLabs/php-github-api/deployments', $filterData); $api->all('KnpLabs', 'php-github-api', $filterData); } @@ -56,7 +56,7 @@ public function shouldCreateStatusUpdate() $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/deployments/1/statuses', $statusData); + ->with('/repos/KnpLabs/php-github-api/deployments/1/statuses', $statusData); $api->updateStatus('KnpLabs', 'php-github-api', 1, $statusData); } @@ -81,7 +81,7 @@ public function shouldGetAllStatuses() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/deployments/1/statuses'); + ->with('/repos/KnpLabs/php-github-api/deployments/1/statuses'); $api->getStatuses('KnpLabs', 'php-github-api', 1); } diff --git a/test/Github/Tests/Api/Enterprise/LicenseTest.php b/test/Github/Tests/Api/Enterprise/LicenseTest.php index af383dcf469..170e478b029 100644 --- a/test/Github/Tests/Api/Enterprise/LicenseTest.php +++ b/test/Github/Tests/Api/Enterprise/LicenseTest.php @@ -23,7 +23,7 @@ public function shouldShowLicenseInformation() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('enterprise/settings/license') + ->with('/enterprise/settings/license') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show()); diff --git a/test/Github/Tests/Api/Enterprise/StatsTest.php b/test/Github/Tests/Api/Enterprise/StatsTest.php index 3bd34ef3fae..18c04799290 100644 --- a/test/Github/Tests/Api/Enterprise/StatsTest.php +++ b/test/Github/Tests/Api/Enterprise/StatsTest.php @@ -16,7 +16,7 @@ public function shouldShowStats() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('enterprise/stats/all') + ->with('/enterprise/stats/all') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show('all')); @@ -33,7 +33,7 @@ public function shouldShowStatsByType($type) $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with(sprintf('enterprise/stats/%s', $type)) + ->with(sprintf('/enterprise/stats/%s', $type)) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, call_user_func(array($api, $type))); diff --git a/test/Github/Tests/Api/Enterprise/UserAdminTest.php b/test/Github/Tests/Api/Enterprise/UserAdminTest.php index 34e6b6e910b..ea6f3fc615f 100644 --- a/test/Github/Tests/Api/Enterprise/UserAdminTest.php +++ b/test/Github/Tests/Api/Enterprise/UserAdminTest.php @@ -15,7 +15,7 @@ public function shouldSuspendUser() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('users/l3l0/suspended') + ->with('/users/l3l0/suspended') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->suspend('l3l0')); } @@ -30,7 +30,7 @@ public function shouldUnsuspendUser() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('users/l3l0/suspended') + ->with('/users/l3l0/suspended') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->unsuspend('l3l0')); diff --git a/test/Github/Tests/Api/Gist/CommentsTest.php b/test/Github/Tests/Api/Gist/CommentsTest.php index daa8f04c5e0..22895e554f0 100644 --- a/test/Github/Tests/Api/Gist/CommentsTest.php +++ b/test/Github/Tests/Api/Gist/CommentsTest.php @@ -16,7 +16,7 @@ public function shouldGetAllGistComments() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('gists/123/comments') + ->with('/gists/123/comments') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('123')); @@ -32,7 +32,7 @@ public function shouldShowGistComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('gists/123/comments/123') + ->with('/gists/123/comments/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show(123, 123)); @@ -48,7 +48,7 @@ public function shouldCreateGistComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('gists/123/comments', array('body' => 'Test body')) + ->with('/gists/123/comments', array('body' => 'Test body')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('123', 'Test body')); @@ -65,7 +65,7 @@ public function shouldUpdateGistComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('gists/123/comments/233', $data) + ->with('/gists/123/comments/233', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update(123, 233, 'body test')); @@ -81,7 +81,7 @@ public function shouldRemoveComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('gists/123/comments/233') + ->with('/gists/123/comments/233') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove(123, 233)); diff --git a/test/Github/Tests/Api/GistsTest.php b/test/Github/Tests/Api/GistsTest.php index 7f5ffe35843..f1a2d0c4134 100644 --- a/test/Github/Tests/Api/GistsTest.php +++ b/test/Github/Tests/Api/GistsTest.php @@ -14,7 +14,7 @@ public function shouldGetStarredGists() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('gists/starred') + ->with('/gists/starred') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->all('starred')); @@ -30,7 +30,7 @@ public function shouldGetAllGists() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('gists') + ->with('/gists') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->all()); @@ -46,7 +46,7 @@ public function shouldShowGist() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('gists/123') + ->with('/gists/123') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show(123)); @@ -62,7 +62,7 @@ public function shouldShowCommits() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('gists/123/commits') + ->with('/gists/123/commits') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->commits(123)); @@ -88,7 +88,7 @@ public function shouldForkGist() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('gists/123/fork') + ->with('/gists/123/fork') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->fork(123)); @@ -104,7 +104,7 @@ public function shouldListGistForks() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('gists/123/forks') + ->with('/gists/123/forks') ->will($this->returnValue($expectedArray)); $api->forks(123); @@ -138,7 +138,7 @@ public function shouldCheckGist() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('gists/123/star') + ->with('/gists/123/star') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->check(123)); @@ -154,7 +154,7 @@ public function shouldStarGist() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('gists/123/star') + ->with('/gists/123/star') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->star(123)); @@ -170,7 +170,7 @@ public function shouldUnstarGist() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('gists/123/star') + ->with('/gists/123/star') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->unstar(123)); @@ -194,7 +194,7 @@ public function shouldCreateAnonymousGist() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('gists', $input); + ->with('/gists', $input); $api->create($input); } @@ -220,7 +220,7 @@ public function shouldUpdateGist() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('gists/5', $input); + ->with('/gists/5', $input); $api->update(5, $input); } @@ -233,7 +233,7 @@ public function shouldDeleteGist() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('gists/5'); + ->with('/gists/5'); $api->remove(5); } diff --git a/test/Github/Tests/Api/GitData/BlobsTest.php b/test/Github/Tests/Api/GitData/BlobsTest.php index 4df2c67a723..25451a2efbb 100644 --- a/test/Github/Tests/Api/GitData/BlobsTest.php +++ b/test/Github/Tests/Api/GitData/BlobsTest.php @@ -14,7 +14,7 @@ public function shouldShowBlob() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/l3l0/l3l0repo/git/blobs/123456sha') + ->with('/repos/l3l0/l3l0repo/git/blobs/123456sha') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('l3l0', 'l3l0repo', '123456sha')); @@ -40,7 +40,7 @@ public function shouldShowRawBlob() ->with('raw'); $api->expects($this->once()) ->method('get') - ->with('repos/l3l0/l3l0repo/git/blobs/123456sha') + ->with('/repos/l3l0/l3l0repo/git/blobs/123456sha') ->will($this->returnValue($expectedValue)); $api->configure('raw'); @@ -59,7 +59,7 @@ public function shouldCreateBlob() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/l3l0/l3l0repo/git/blobs', $data) + ->with('/repos/l3l0/l3l0repo/git/blobs', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('l3l0', 'l3l0repo', $data)); diff --git a/test/Github/Tests/Api/GitData/CommitsTest.php b/test/Github/Tests/Api/GitData/CommitsTest.php index fa3cd60f1a8..9c881805bcb 100644 --- a/test/Github/Tests/Api/GitData/CommitsTest.php +++ b/test/Github/Tests/Api/GitData/CommitsTest.php @@ -14,7 +14,7 @@ public function shouldShowCommitUsingSha() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/git/commits/123') + ->with('/repos/KnpLabs/php-github-api/git/commits/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 123)); @@ -31,7 +31,7 @@ public function shouldCreateCommit() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/git/commits', $data) + ->with('/repos/KnpLabs/php-github-api/git/commits', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); diff --git a/test/Github/Tests/Api/GitData/ReferencesTest.php b/test/Github/Tests/Api/GitData/ReferencesTest.php index 48f1775c6e5..600d7c42f30 100644 --- a/test/Github/Tests/Api/GitData/ReferencesTest.php +++ b/test/Github/Tests/Api/GitData/ReferencesTest.php @@ -14,7 +14,7 @@ public function shouldNotEscapeSlashesInReferences() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/l3l0/l3l0repo/git/refs/master/some%2A%26%40%23branch/dasd1212') + ->with('/repos/l3l0/l3l0repo/git/refs/master/some%2A%26%40%23branch/dasd1212') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('l3l0', 'l3l0repo', 'master/some*&@#branch/dasd1212')); @@ -30,7 +30,7 @@ public function shouldShowReference() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/l3l0/l3l0repo/git/refs/123456sha') + ->with('/repos/l3l0/l3l0repo/git/refs/123456sha') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('l3l0', 'l3l0repo', '123456sha')); @@ -46,7 +46,7 @@ public function shouldRemoveReference() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/l3l0/l3l0repo/git/refs/123456sha') + ->with('/repos/l3l0/l3l0repo/git/refs/123456sha') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('l3l0', 'l3l0repo', '123456sha')); @@ -62,7 +62,7 @@ public function shouldGetAllRepoReferences() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/l3l0/l3l0repo/git/refs') + ->with('/repos/l3l0/l3l0repo/git/refs') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('l3l0', 'l3l0repo')); @@ -78,7 +78,7 @@ public function shouldGetAllRepoBranches() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/l3l0/l3l0repo/git/refs/heads') + ->with('/repos/l3l0/l3l0repo/git/refs/heads') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->branches('l3l0', 'l3l0repo')); @@ -94,7 +94,7 @@ public function shouldGetAllRepoTags() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/l3l0/l3l0repo/git/refs/tags') + ->with('/repos/l3l0/l3l0repo/git/refs/tags') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->tags('l3l0', 'l3l0repo')); @@ -111,7 +111,7 @@ public function shouldCreateReference() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/l3l0/l3l0repo/git/refs', $data) + ->with('/repos/l3l0/l3l0repo/git/refs', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('l3l0', 'l3l0repo', $data)); @@ -158,7 +158,7 @@ public function shouldUpdateReference() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/l3l0/l3l0repo/git/refs/someRefs', $data) + ->with('/repos/l3l0/l3l0repo/git/refs/someRefs', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('l3l0', 'l3l0repo', 'someRefs', $data)); diff --git a/test/Github/Tests/Api/GitData/TagsTest.php b/test/Github/Tests/Api/GitData/TagsTest.php index 3062e5bba2f..80920fca840 100644 --- a/test/Github/Tests/Api/GitData/TagsTest.php +++ b/test/Github/Tests/Api/GitData/TagsTest.php @@ -14,7 +14,7 @@ public function shouldShowTagUsingSha() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/git/tags/123') + ->with('/repos/KnpLabs/php-github-api/git/tags/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 123)); @@ -30,7 +30,7 @@ public function shouldGetAllTags() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/git/refs/tags') + ->with('/repos/KnpLabs/php-github-api/git/refs/tags') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -57,7 +57,7 @@ public function shouldCreateTag() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/git/tags', $data) + ->with('/repos/KnpLabs/php-github-api/git/tags', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); diff --git a/test/Github/Tests/Api/GitData/TreesTest.php b/test/Github/Tests/Api/GitData/TreesTest.php index 1313f282f41..2333744f987 100644 --- a/test/Github/Tests/Api/GitData/TreesTest.php +++ b/test/Github/Tests/Api/GitData/TreesTest.php @@ -14,7 +14,7 @@ public function shouldShowTreeUsingSha() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/git/trees/123', array()) + ->with('/repos/KnpLabs/php-github-api/git/trees/123', array()) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 123)); @@ -46,7 +46,7 @@ public function shouldCreateTreeUsingSha() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/git/trees', $data) + ->with('/repos/KnpLabs/php-github-api/git/trees', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); @@ -78,7 +78,7 @@ public function shouldCreateTreeUsingContent() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/git/trees', $data) + ->with('/repos/KnpLabs/php-github-api/git/trees', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); diff --git a/test/Github/Tests/Api/Issue/CommentsTest.php b/test/Github/Tests/Api/Issue/CommentsTest.php index eca7bf45a98..128e4401637 100644 --- a/test/Github/Tests/Api/Issue/CommentsTest.php +++ b/test/Github/Tests/Api/Issue/CommentsTest.php @@ -16,7 +16,7 @@ public function shouldGetAllIssueComments() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/issues/123/comments', array('page' => 1)) + ->with('/repos/KnpLabs/php-github-api/issues/123/comments', array('page' => 1)) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', 123)); @@ -32,7 +32,7 @@ public function shouldShowIssueComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/issues/comments/123') + ->with('/repos/KnpLabs/php-github-api/issues/comments/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 123)); @@ -64,7 +64,7 @@ public function shouldCreateIssueComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/issues/123/comments', $data) + ->with('/repos/KnpLabs/php-github-api/issues/123/comments', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', '123', $data)); @@ -96,7 +96,7 @@ public function shouldUpdateIssueComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/KnpLabs/php-github-api/issues/comments/233', $data) + ->with('/repos/KnpLabs/php-github-api/issues/comments/233', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpLabs', 'php-github-api', '233', $data)); @@ -112,7 +112,7 @@ public function shouldRemoveComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/issues/comments/123') + ->with('/repos/KnpLabs/php-github-api/issues/comments/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'php-github-api', 123)); diff --git a/test/Github/Tests/Api/Issue/EventsTest.php b/test/Github/Tests/Api/Issue/EventsTest.php index a86aa02cfc4..5168bfd90ba 100644 --- a/test/Github/Tests/Api/Issue/EventsTest.php +++ b/test/Github/Tests/Api/Issue/EventsTest.php @@ -16,7 +16,7 @@ public function shouldGetAllRepoIssuesEvents() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/issues/events', array('page' => 1)) + ->with('/repos/KnpLabs/php-github-api/issues/events', array('page' => 1)) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -32,7 +32,7 @@ public function shouldGetIssueEvents() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/issues/123/events', array('page' => 1)) + ->with('/repos/KnpLabs/php-github-api/issues/123/events', array('page' => 1)) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', 123)); @@ -48,7 +48,7 @@ public function shouldShowIssueEvent() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/issues/events/123') + ->with('/repos/KnpLabs/php-github-api/issues/events/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 123)); diff --git a/test/Github/Tests/Api/Issue/LabelsTest.php b/test/Github/Tests/Api/Issue/LabelsTest.php index c8a457e0ac5..24c0bdfead5 100644 --- a/test/Github/Tests/Api/Issue/LabelsTest.php +++ b/test/Github/Tests/Api/Issue/LabelsTest.php @@ -19,7 +19,7 @@ public function shouldGetProjectLabels() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/labels', array()) + ->with('/repos/KnpLabs/php-github-api/labels', array()) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -35,7 +35,7 @@ public function shouldGetAllIssueLabels() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/issues/123/labels') + ->with('/repos/KnpLabs/php-github-api/issues/123/labels') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', '123')); @@ -52,7 +52,7 @@ public function shouldCreateLabel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/labels', $data + array('color' => 'FFFFFF')) + ->with('/repos/KnpLabs/php-github-api/labels', $data + array('color' => 'FFFFFF')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); @@ -69,7 +69,7 @@ public function shouldCreateLabelWithColor() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/labels', $data) + ->with('/repos/KnpLabs/php-github-api/labels', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); @@ -85,7 +85,7 @@ public function shouldDeleteLabel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/labels/foo') + ->with('/repos/KnpLabs/php-github-api/labels/foo') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->deleteLabel('KnpLabs', 'php-github-api', 'foo')); @@ -102,7 +102,7 @@ public function shouldUpdateLabel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/KnpLabs/php-github-api/labels/foo', $data) + ->with('/repos/KnpLabs/php-github-api/labels/foo', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpLabs', 'php-github-api', 'foo', 'bar', 'FFF')); @@ -118,7 +118,7 @@ public function shouldRemoveLabel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/issues/123/labels/somename') + ->with('/repos/KnpLabs/php-github-api/issues/123/labels/somename') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'php-github-api', 123, 'somename')); @@ -134,7 +134,7 @@ public function shouldAddOneLabel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/issues/123/labels', array('labelname')) + ->with('/repos/KnpLabs/php-github-api/issues/123/labels', array('labelname')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->add('KnpLabs', 'php-github-api', 123, 'labelname')); @@ -150,7 +150,7 @@ public function shouldAddManyLabels() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/issues/123/labels', array('labelname', 'labelname2')) + ->with('/repos/KnpLabs/php-github-api/issues/123/labels', array('labelname', 'labelname2')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->add('KnpLabs', 'php-github-api', 123, array('labelname', 'labelname2'))); @@ -167,7 +167,7 @@ public function shouldReplaceLabels() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('repos/KnpLabs/php-github-api/issues/123/labels', $data) + ->with('/repos/KnpLabs/php-github-api/issues/123/labels', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->replace('KnpLabs', 'php-github-api', 123, $data)); @@ -196,7 +196,7 @@ public function shouldClearLabels() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/issues/123/labels') + ->with('/repos/KnpLabs/php-github-api/issues/123/labels') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->clear('KnpLabs', 'php-github-api', 123)); diff --git a/test/Github/Tests/Api/Issue/MilestonesTest.php b/test/Github/Tests/Api/Issue/MilestonesTest.php index 85594f69844..e9c0b3dde21 100644 --- a/test/Github/Tests/Api/Issue/MilestonesTest.php +++ b/test/Github/Tests/Api/Issue/MilestonesTest.php @@ -16,7 +16,7 @@ public function shouldGetMilestones() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc')) + ->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -33,7 +33,7 @@ public function shouldCreateMilestone() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/milestones', $data) + ->with('/repos/KnpLabs/php-github-api/milestones', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); @@ -65,7 +65,7 @@ public function shouldSetStateToOpenWhileCreationWhenStateParamNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/milestones', array('state' => 'open', 'title' => 'milestone')) + ->with('/repos/KnpLabs/php-github-api/milestones', array('state' => 'open', 'title' => 'milestone')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', array('state' => 'clos', 'title' => 'milestone'))); @@ -82,7 +82,7 @@ public function shouldUpdateMilestone() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/KnpLabs/php-github-api/milestones/123', array('title' => 'milestone')) + ->with('/repos/KnpLabs/php-github-api/milestones/123', array('title' => 'milestone')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpLabs', 'php-github-api', 123, $data)); @@ -99,7 +99,7 @@ public function shouldUpdateMilestoneWithClosedStatus() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/KnpLabs/php-github-api/milestones/123', $data) + ->with('/repos/KnpLabs/php-github-api/milestones/123', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpLabs', 'php-github-api', 123, $data)); @@ -116,7 +116,7 @@ public function shouldSetStateToOpenWhileUpdateWhenStateParamNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/KnpLabs/php-github-api/milestones/123', array('state' => 'open', 'title' => 'milestone')) + ->with('/repos/KnpLabs/php-github-api/milestones/123', array('state' => 'open', 'title' => 'milestone')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpLabs', 'php-github-api', 123, $data)); @@ -132,7 +132,7 @@ public function shouldSortByDueDateWhenSortParamNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc')) + ->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', array('sort' => 'completenes'))); @@ -148,7 +148,7 @@ public function shouldSetStateToOpenWhenStateParamNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc')) + ->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', array('state' => 'clos'))); @@ -164,7 +164,7 @@ public function shouldSetDirectionToDescWhenDirectionParamNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc')) + ->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', array('direction' => 'des'))); @@ -180,7 +180,7 @@ public function shouldRemoveMilestones() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/milestones/123') + ->with('/repos/KnpLabs/php-github-api/milestones/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'php-github-api', 123)); @@ -196,7 +196,7 @@ public function shouldShowMilestone() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/milestones/123') + ->with('/repos/KnpLabs/php-github-api/milestones/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 123)); @@ -212,7 +212,7 @@ public function shouldGetMilestoneLabels() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/milestones/123/labels') + ->with('/repos/KnpLabs/php-github-api/milestones/123/labels') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->labels('KnpLabs', 'php-github-api', 123)); diff --git a/test/Github/Tests/Api/IssueTest.php b/test/Github/Tests/Api/IssueTest.php index 52bb39a240c..b20efbf9233 100644 --- a/test/Github/Tests/Api/IssueTest.php +++ b/test/Github/Tests/Api/IssueTest.php @@ -19,7 +19,7 @@ public function shouldGetIssues() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/ornicar/php-github-api/issues', $sentData); + ->with('/repos/ornicar/php-github-api/issues', $sentData); $api->all('ornicar', 'php-github-api', $data); } @@ -46,7 +46,7 @@ public function shouldGetIssuesUsingAdditionalParameters() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/ornicar/php-github-api/issues', $sentData) + ->with('/repos/ornicar/php-github-api/issues', $sentData) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->all('ornicar', 'php-github-api', $data)); @@ -62,7 +62,7 @@ public function shouldShowIssue() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/ornicar/php-github-api/issues/14') + ->with('/repos/ornicar/php-github-api/issues/14') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show('ornicar', 'php-github-api', 14)); @@ -81,7 +81,7 @@ public function shouldCreateIssue() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/ornicar/php-github-api/issues', $data); + ->with('/repos/ornicar/php-github-api/issues', $data); $api->create('ornicar', 'php-github-api', $data); } @@ -132,7 +132,7 @@ public function shouldCloseIssue() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/ornicar/php-github-api/issues/14', $data); + ->with('/repos/ornicar/php-github-api/issues/14', $data); $api->update('ornicar', 'php-github-api', 14, $data); } @@ -149,7 +149,7 @@ public function shouldReOpenIssue() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/ornicar/php-github-api/issues/14', $data); + ->with('/repos/ornicar/php-github-api/issues/14', $data); $api->update('ornicar', 'php-github-api', 14, $data); } @@ -164,7 +164,7 @@ public function shouldSearchOpenIssues() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('legacy/issues/search/KnpLabs/php-github-api/open/Invalid%20Commits') + ->with('/legacy/issues/search/KnpLabs/php-github-api/open/Invalid%20Commits') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->find('KnpLabs', 'php-github-api', 'open', 'Invalid Commits')); @@ -180,7 +180,7 @@ public function shouldSearchClosedIssues() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('legacy/issues/search/KnpLabs/php-github-api/closed/Invalid%20Commits') + ->with('/legacy/issues/search/KnpLabs/php-github-api/closed/Invalid%20Commits') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->find('KnpLabs', 'php-github-api', 'closed', 'Invalid Commits')); @@ -196,7 +196,7 @@ public function shouldSearchOpenIssuesWhenStateNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('legacy/issues/search/KnpLabs/php-github-api/open/Invalid%20Commits') + ->with('/legacy/issues/search/KnpLabs/php-github-api/open/Invalid%20Commits') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->find('KnpLabs', 'php-github-api', 'abc', 'Invalid Commits')); diff --git a/test/Github/Tests/Api/MarkdownTest.php b/test/Github/Tests/Api/MarkdownTest.php index 6208a4b84e5..9bd91651e23 100644 --- a/test/Github/Tests/Api/MarkdownTest.php +++ b/test/Github/Tests/Api/MarkdownTest.php @@ -14,7 +14,7 @@ public function shouldRenderMarkdown() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('markdown', array('text' => $input, 'mode' => 'markdown')); + ->with('/markdown', array('text' => $input, 'mode' => 'markdown')); $api->render($input); } @@ -29,7 +29,7 @@ public function shouldRenderMarkdownUsingGfmMode() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('markdown', array('text' => $input, 'mode' => 'gfm')); + ->with('/markdown', array('text' => $input, 'mode' => 'gfm')); $api->render($input, 'gfm'); } @@ -44,7 +44,7 @@ public function shouldSetModeToMarkdownWhenIsNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('markdown', array('text' => $input, 'mode' => 'markdown')); + ->with('/markdown', array('text' => $input, 'mode' => 'markdown')); $api->render($input, 'abc'); } @@ -59,12 +59,12 @@ public function shouldSetContextOnlyForGfmMode() $apiWithMarkdown = $this->getApiMock(); $apiWithMarkdown->expects($this->once()) ->method('post') - ->with('markdown', array('text' => $input, 'mode' => 'markdown')); + ->with('/markdown', array('text' => $input, 'mode' => 'markdown')); $apiWithGfm = $this->getApiMock(); $apiWithGfm->expects($this->once()) ->method('post') - ->with('markdown', array('text' => $input, 'mode' => 'gfm', 'context' => 'someContext')); + ->with('/markdown', array('text' => $input, 'mode' => 'gfm', 'context' => 'someContext')); $apiWithMarkdown->render($input, 'markdown', 'someContext'); $apiWithGfm->render($input, 'gfm', 'someContext'); @@ -80,7 +80,7 @@ public function shouldRenderRawFile() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('markdown/raw', array('file' => $file)); + ->with('/markdown/raw', array('file' => $file)); $api->renderRaw($file); } diff --git a/test/Github/Tests/Api/NotificationTest.php b/test/Github/Tests/Api/NotificationTest.php index a212530fffd..35fc09a188c 100644 --- a/test/Github/Tests/Api/NotificationTest.php +++ b/test/Github/Tests/Api/NotificationTest.php @@ -19,7 +19,7 @@ public function shouldGetNotifications() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('notifications', $parameters); + ->with('/notifications', $parameters); $api->all(); } @@ -40,7 +40,7 @@ public function shouldGetNotificationsSince() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('notifications', $parameters); + ->with('/notifications', $parameters); $api->all(false, false, $since); } @@ -58,7 +58,7 @@ public function shouldGetNotificationsIncludingAndParticipating() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('notifications', $parameters); + ->with('/notifications', $parameters); $api->all(true, true); } @@ -73,7 +73,7 @@ public function shouldMarkNotificationsAsRead() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('notifications', $parameters); + ->with('/notifications', $parameters); $api->markRead(); } @@ -92,7 +92,7 @@ public function shouldMarkNotificationsAsReadForGivenDate() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('notifications', $parameters); + ->with('/notifications', $parameters); $api->markRead($since); } diff --git a/test/Github/Tests/Api/Organization/HooksTest.php b/test/Github/Tests/Api/Organization/HooksTest.php index a3cdd4fcba4..113c7bb2433 100644 --- a/test/Github/Tests/Api/Organization/HooksTest.php +++ b/test/Github/Tests/Api/Organization/HooksTest.php @@ -16,7 +16,7 @@ public function shouldGetAllOrganizationsHooks() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('orgs/KnpLabs/hooks') + ->with('/orgs/KnpLabs/hooks') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs')); @@ -32,7 +32,7 @@ public function shouldShowHook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('orgs/KnpLabs/hooks/123') + ->with('/orgs/KnpLabs/hooks/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 123)); @@ -48,7 +48,7 @@ public function shouldRemoveHook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('orgs/KnpLabs/hooks/123') + ->with('/orgs/KnpLabs/hooks/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 123)); @@ -95,7 +95,7 @@ public function shouldCreateHook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('orgs/KnpLabs/hooks', $data) + ->with('/orgs/KnpLabs/hooks', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', $data)); @@ -127,7 +127,7 @@ public function shouldUpdateHook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('orgs/KnpLabs/hooks/123', $data) + ->with('/orgs/KnpLabs/hooks/123', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpLabs', 123, $data)); @@ -143,7 +143,7 @@ public function shouldPingHook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('orgs/KnpLabs/hooks/123/pings') + ->with('/orgs/KnpLabs/hooks/123/pings') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->ping('KnpLabs', 123)); diff --git a/test/Github/Tests/Api/Organization/MembersTest.php b/test/Github/Tests/Api/Organization/MembersTest.php index 8a6a252e0c8..f25b74b47f3 100644 --- a/test/Github/Tests/Api/Organization/MembersTest.php +++ b/test/Github/Tests/Api/Organization/MembersTest.php @@ -16,7 +16,7 @@ public function shouldGetAllOrganizationMembers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('orgs/KnpLabs/members') + ->with('/orgs/KnpLabs/members') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs')); @@ -32,7 +32,7 @@ public function shouldGetPublicOrganizationMembers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('orgs/KnpLabs/public_members') + ->with('/orgs/KnpLabs/public_members') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', true)); @@ -48,7 +48,7 @@ public function shouldCheckIfOrganizationMember() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('orgs/KnpLabs/public_members/l3l0') + ->with('/orgs/KnpLabs/public_members/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->check('KnpLabs', 'l3l0')); @@ -64,7 +64,7 @@ public function shouldAddOrganizationMember() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('orgs/KnpLabs/memberships/l3l0') + ->with('/orgs/KnpLabs/memberships/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->add('KnpLabs', 'l3l0')); @@ -80,7 +80,7 @@ public function shouldRemoveOrganizationMember() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('orgs/KnpLabs/members/l3l0') + ->with('/orgs/KnpLabs/members/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'l3l0')); @@ -96,7 +96,7 @@ public function shouldPublicizeOrganizationMembership() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('orgs/KnpLabs/public_members/l3l0') + ->with('/orgs/KnpLabs/public_members/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->publicize('KnpLabs', 'l3l0')); @@ -112,7 +112,7 @@ public function shouldConcealOrganizationMembership() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('orgs/KnpLabs/public_members/l3l0') + ->with('/orgs/KnpLabs/public_members/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->conceal('KnpLabs', 'l3l0')); @@ -128,7 +128,7 @@ public function shouldShowOrganizationMember() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('orgs/KnpLabs/members/l3l0') + ->with('/orgs/KnpLabs/members/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'l3l0')); diff --git a/test/Github/Tests/Api/Organization/TeamsTest.php b/test/Github/Tests/Api/Organization/TeamsTest.php index 5a38555f1d5..fa21be45dc7 100644 --- a/test/Github/Tests/Api/Organization/TeamsTest.php +++ b/test/Github/Tests/Api/Organization/TeamsTest.php @@ -16,7 +16,7 @@ public function shouldGetAllOrganizationTeams() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('orgs/KnpLabs/teams') + ->with('/orgs/KnpLabs/teams') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs')); @@ -32,7 +32,7 @@ public function shouldCheckIfMemberIsInOrganizationTeam() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('teams/KnpWorld/memberships/l3l0') + ->with('/teams/KnpWorld/memberships/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->check('KnpWorld', 'l3l0')); @@ -48,7 +48,7 @@ public function shouldRemoveOrganizationTeam() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('teams/KnpWorld') + ->with('/teams/KnpWorld') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpWorld')); @@ -64,7 +64,7 @@ public function shouldShowOrganizationTeam() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('teams/KnpWorld') + ->with('/teams/KnpWorld') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpWorld')); @@ -80,7 +80,7 @@ public function shouldGetTeamMembers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('teams/KnpWorld/members') + ->with('/teams/KnpWorld/members') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->members('KnpWorld')); @@ -96,7 +96,7 @@ public function shouldAddTeamMembers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('teams/KnpWorld/memberships/l3l0') + ->with('/teams/KnpWorld/memberships/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->addMember('KnpWorld', 'l3l0')); @@ -112,7 +112,7 @@ public function shouldRemoveTeamMembers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('teams/KnpWorld/memberships/l3l0') + ->with('/teams/KnpWorld/memberships/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->removeMember('KnpWorld', 'l3l0')); @@ -128,7 +128,7 @@ public function shouldGetTeamRepositories() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('teams/KnpWorld/repos') + ->with('/teams/KnpWorld/repos') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->repositories('KnpWorld')); @@ -144,7 +144,7 @@ public function shouldGetTeamRepository() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('teams/KnpWorld/repos/l3l0/l3l0Repo') + ->with('/teams/KnpWorld/repos/l3l0/l3l0Repo') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->repository('KnpWorld', 'l3l0', 'l3l0Repo')); @@ -160,7 +160,7 @@ public function shouldAddTeamRepository() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('teams/KnpWorld/repos/l3l0/l3l0Repo') + ->with('/teams/KnpWorld/repos/l3l0/l3l0Repo') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->addRepository('KnpWorld', 'l3l0', 'l3l0Repo')); @@ -176,7 +176,7 @@ public function shouldRemoveTeamRepository() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('teams/KnpWorld/repos/l3l0/l3l0Repo') + ->with('/teams/KnpWorld/repos/l3l0/l3l0Repo') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->removeRepository('KnpWorld', 'l3l0', 'l3l0Repo')); @@ -208,7 +208,7 @@ public function shouldCreateOrganizationTeam() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('orgs/KnpLabs/teams', $data) + ->with('/orgs/KnpLabs/teams', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', $data)); @@ -225,7 +225,7 @@ public function shouldCreateOrganizationTeamWithRepoName() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('orgs/KnpLabs/teams', array('name' => 'KnpWorld', 'repo_names' => array('somerepo'))) + ->with('/orgs/KnpLabs/teams', array('name' => 'KnpWorld', 'repo_names' => array('somerepo'))) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', $data)); @@ -242,7 +242,7 @@ public function shouldCreateWithPullPermissionWhenPermissionParamNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('orgs/KnpLabs/teams', array('name' => 'KnpWorld', 'permission' => 'pull')) + ->with('/orgs/KnpLabs/teams', array('name' => 'KnpWorld', 'permission' => 'pull')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', $data)); @@ -274,7 +274,7 @@ public function shouldUpdateOrganizationTeam() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('teams/KnpWorld', $data) + ->with('/teams/KnpWorld', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpWorld', $data)); @@ -291,7 +291,7 @@ public function shouldUpdateWithPullPermissionWhenPermissionParamNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('teams/KnpWorld', array('name' => 'KnpWorld', 'permission' => 'pull')) + ->with('/teams/KnpWorld', array('name' => 'KnpWorld', 'permission' => 'pull')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpWorld', $data)); diff --git a/test/Github/Tests/Api/OrganizationTest.php b/test/Github/Tests/Api/OrganizationTest.php index 0a673dbb065..ca70ffbb232 100644 --- a/test/Github/Tests/Api/OrganizationTest.php +++ b/test/Github/Tests/Api/OrganizationTest.php @@ -14,7 +14,7 @@ public function shouldGetAllOrganizations() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('organizations?since=1') + ->with('/organizations?since=1') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all(1)); @@ -30,7 +30,7 @@ public function shouldShowOrganization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('orgs/KnpLabs') + ->with('/orgs/KnpLabs') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show('KnpLabs')); @@ -46,7 +46,7 @@ public function shouldUpdateOrganization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('orgs/KnpLabs', array('value' => 'toUpdate')) + ->with('/orgs/KnpLabs', array('value' => 'toUpdate')) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update('KnpLabs', array('value' => 'toUpdate'))); @@ -62,7 +62,7 @@ public function shouldGetOrganizationRepositories() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('orgs/KnpLabs/repos', array('type' => 'all')) + ->with('/orgs/KnpLabs/repos', array('type' => 'all')) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->repositories('KnpLabs')); diff --git a/test/Github/Tests/Api/PullRequestTest.php b/test/Github/Tests/Api/PullRequestTest.php index cf18f9e3b82..6e0f562765f 100644 --- a/test/Github/Tests/Api/PullRequestTest.php +++ b/test/Github/Tests/Api/PullRequestTest.php @@ -14,7 +14,7 @@ public function shouldGetAllPullRequests() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/ezsystems/ezpublish/pulls') + ->with('/repos/ezsystems/ezpublish/pulls') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->all('ezsystems', 'ezpublish')); @@ -30,7 +30,7 @@ public function shouldGetOpenPullRequests() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/ezsystems/ezpublish/pulls', array('state' => 'open', 'per_page' => 30, 'page' => 1)) + ->with('/repos/ezsystems/ezpublish/pulls', array('state' => 'open', 'per_page' => 30, 'page' => 1)) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->all('ezsystems', 'ezpublish', array('state' => 'open'))); @@ -46,7 +46,7 @@ public function shouldGetClosedPullRequests() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/ezsystems/ezpublish/pulls', array('state' => 'closed', 'per_page' => 30, 'page' => 1)) + ->with('/repos/ezsystems/ezpublish/pulls', array('state' => 'closed', 'per_page' => 30, 'page' => 1)) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->all('ezsystems', 'ezpublish', array('state' => 'closed'))); @@ -63,7 +63,7 @@ public function shouldShowPullRequest() $api->expects($this->once()) ->method('get') - ->with('repos/ezsystems/ezpublish/pulls/15') + ->with('/repos/ezsystems/ezpublish/pulls/15') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show('ezsystems', 'ezpublish', '15')); @@ -79,7 +79,7 @@ public function shouldShowCommitsFromPullRequest() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/ezsystems/ezpublish/pulls/15/commits') + ->with('/repos/ezsystems/ezpublish/pulls/15/commits') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->commits('ezsystems', 'ezpublish', '15')); @@ -95,7 +95,7 @@ public function shouldShowFilesFromPullRequest() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/ezsystems/ezpublish/pulls/15/files') + ->with('/repos/ezsystems/ezpublish/pulls/15/files') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->files('ezsystems', 'ezpublish', '15')); @@ -111,7 +111,7 @@ public function shouldUpdatePullRequests() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/ezsystems/ezpublish/pulls/15', array('state' => 'open', 'some' => 'param')) + ->with('/repos/ezsystems/ezpublish/pulls/15', array('state' => 'open', 'some' => 'param')) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update('ezsystems', 'ezpublish', 15, array('state' => 'aa', 'some' => 'param'))); @@ -127,7 +127,7 @@ public function shouldCheckIfPullRequestIsMerged() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/ezsystems/ezpublish/pulls/15/merge') + ->with('/repos/ezsystems/ezpublish/pulls/15/merge') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->merged('ezsystems', 'ezpublish', 15)); @@ -143,7 +143,7 @@ public function shouldMergePullRequest() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('repos/ezsystems/ezpublish/pulls/15/merge', array('commit_message' => 'Merged something', 'sha' => str_repeat('A', 40), 'squash' => false)) + ->with('/repos/ezsystems/ezpublish/pulls/15/merge', array('commit_message' => 'Merged something', 'sha' => str_repeat('A', 40), 'squash' => false)) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->merge('ezsystems', 'ezpublish', 15, 'Merged something', str_repeat('A', 40))); @@ -164,7 +164,7 @@ public function shouldCreatePullRequestUsingTitle() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/ezsystems/ezpublish/pulls', $data); + ->with('/repos/ezsystems/ezpublish/pulls', $data); $api->create('ezsystems', 'ezpublish', $data); } @@ -183,7 +183,7 @@ public function shouldCreatePullRequestUsingIssueId() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/ezsystems/ezpublish/pulls', $data); + ->with('/repos/ezsystems/ezpublish/pulls', $data); $api->create('ezsystems', 'ezpublish', $data); } diff --git a/test/Github/Tests/Api/RateLimitTest.php b/test/Github/Tests/Api/RateLimitTest.php index 4f1b8c467d3..382e0411792 100644 --- a/test/Github/Tests/Api/RateLimitTest.php +++ b/test/Github/Tests/Api/RateLimitTest.php @@ -27,7 +27,7 @@ public function shouldReturnRateLimitArray() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('rate_limit') + ->with('/rate_limit') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->getRateLimits()); diff --git a/test/Github/Tests/Api/RepoTest.php b/test/Github/Tests/Api/RepoTest.php index 3ada7d440fb..6ef8af7b375 100644 --- a/test/Github/Tests/Api/RepoTest.php +++ b/test/Github/Tests/Api/RepoTest.php @@ -14,7 +14,7 @@ public function shouldShowRepository() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api') + ->with('/repos/KnpLabs/php-github-api') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show('KnpLabs', 'php-github-api')); @@ -33,7 +33,7 @@ public function shouldSearchRepositories() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('legacy/repos/search/php', array('myparam' => 2, 'start_page' => 1)) + ->with('/legacy/repos/search/php', array('myparam' => 2, 'start_page' => 1)) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->find('php', array('myparam' => 2))); @@ -52,7 +52,7 @@ public function shouldPaginateFoundRepositories() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('legacy/repos/search/php', array('start_page' => 2)) + ->with('/legacy/repos/search/php', array('start_page' => 2)) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->find('php', array('start_page' => 2))); @@ -73,7 +73,7 @@ public function shouldGetAllRepositories() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repositories') + ->with('/repositories') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->all()); @@ -94,7 +94,7 @@ public function shouldGetAllRepositoriesStartingIndex() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repositories?since=2') + ->with('/repositories?since=2') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->all(2)); @@ -110,7 +110,7 @@ public function shouldCreateRepositoryUsingNameOnly() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('user/repos', array( + ->with('/user/repos', array( 'name' => 'l3l0Repo', 'description' => '', 'homepage' => '', @@ -135,7 +135,7 @@ public function shouldCreateRepositoryForOrganization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('orgs/KnpLabs/repos', array( + ->with('/orgs/KnpLabs/repos', array( 'name' => 'KnpLabsRepo', 'description' => '', 'homepage' => '', @@ -160,7 +160,7 @@ public function shouldGetRepositorySubscribers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/subscribers', array('page' => 2)) + ->with('/repos/KnpLabs/php-github-api/subscribers', array('page' => 2)) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->subscribers('KnpLabs', 'php-github-api', 2)); @@ -176,7 +176,7 @@ public function shouldGetRepositoryTags() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/tags') + ->with('/repos/KnpLabs/php-github-api/tags') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->tags('KnpLabs', 'php-github-api')); @@ -192,7 +192,7 @@ public function shouldGetRepositoryBranches() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/branches') + ->with('/repos/KnpLabs/php-github-api/branches') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->branches('KnpLabs', 'php-github-api')); @@ -208,7 +208,7 @@ public function shouldGetRepositoryBranch() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/branches/master') + ->with('/repos/KnpLabs/php-github-api/branches/master') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->branches('KnpLabs', 'php-github-api', 'master')); @@ -224,7 +224,7 @@ public function shouldGetRepositoryLanguages() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/languages') + ->with('/repos/KnpLabs/php-github-api/languages') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->languages('KnpLabs', 'php-github-api')); @@ -240,7 +240,7 @@ public function shouldGetRepositoryMilestones() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/milestones') + ->with('/repos/KnpLabs/php-github-api/milestones') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->milestones('KnpLabs', 'php-github-api')); @@ -256,7 +256,7 @@ public function shouldGetContributorsExcludingAnonymousOnes() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/contributors', array('anon' => null)) + ->with('/repos/KnpLabs/php-github-api/contributors', array('anon' => null)) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->contributors('KnpLabs', 'php-github-api', false)); @@ -272,7 +272,7 @@ public function shouldGetContributorsIncludingAnonymousOnes() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/contributors', array('anon' => true)) + ->with('/repos/KnpLabs/php-github-api/contributors', array('anon' => true)) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->contributors('KnpLabs', 'php-github-api', true)); @@ -288,7 +288,7 @@ public function shouldGetRepositoryTeams() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/teams') + ->with('/repos/KnpLabs/php-github-api/teams') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->teams('KnpLabs', 'php-github-api')); @@ -304,7 +304,7 @@ public function shouldCreateUsingAllParams() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('user/repos', array( + ->with('/user/repos', array( 'name' => 'l3l0Repo', 'description' => 'test', 'homepage' => 'http://l3l0.eu', @@ -329,7 +329,7 @@ public function shouldUpdate() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/l3l0Repo/test', array('description' => 'test', 'homepage' => 'http://l3l0.eu')) + ->with('/repos/l3l0Repo/test', array('description' => 'test', 'homepage' => 'http://l3l0.eu')) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update('l3l0Repo', 'test', array('description' => 'test', 'homepage' => 'http://l3l0.eu'))); @@ -343,7 +343,7 @@ public function shouldDelete() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/l3l0Repo/test') + ->with('/repos/l3l0Repo/test') ->will($this->returnValue(null)); $this->assertNull($api->remove('l3l0Repo', 'test')); @@ -359,7 +359,7 @@ public function shouldNotDelete() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/l3l0Repo/uknown-repo') + ->with('/repos/l3l0Repo/uknown-repo') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->remove('l3l0Repo', 'uknown-repo')); @@ -495,7 +495,7 @@ public function shouldGetCommitActivity() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/stats/commit_activity') + ->with('/repos/KnpLabs/php-github-api/stats/commit_activity') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->activity('KnpLabs', 'php-github-api')); diff --git a/test/Github/Tests/Api/Repository/AssetsTest.php b/test/Github/Tests/Api/Repository/AssetsTest.php index 174268468ca..67c6213b4ce 100644 --- a/test/Github/Tests/Api/Repository/AssetsTest.php +++ b/test/Github/Tests/Api/Repository/AssetsTest.php @@ -17,7 +17,7 @@ public function shouldGetAllReleaseAssets() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/releases/'.$id.'/assets') + ->with('/repos/KnpLabs/php-github-api/releases/'.$id.'/assets') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', $id)); @@ -34,7 +34,7 @@ public function shouldGetSingleReleaseAsset() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/releases/assets/'.$assetId) + ->with('/repos/KnpLabs/php-github-api/releases/assets/'.$assetId) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', $assetId)); @@ -78,7 +78,7 @@ public function shouldEditReleaseAsset() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/KnpLabs/php-github-api/releases/assets/'.$assetId) + ->with('/repos/KnpLabs/php-github-api/releases/assets/'.$assetId) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->edit('KnpLabs', 'php-github-api', $assetId, $data)); @@ -111,7 +111,7 @@ public function shouldRemoveReleaseAsset() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/releases/assets/'.$assetId) + ->with('/repos/KnpLabs/php-github-api/releases/assets/'.$assetId) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'php-github-api', $assetId)); diff --git a/test/Github/Tests/Api/Repository/CollaboratorsTest.php b/test/Github/Tests/Api/Repository/CollaboratorsTest.php index 6f8c924151a..0eb75818277 100644 --- a/test/Github/Tests/Api/Repository/CollaboratorsTest.php +++ b/test/Github/Tests/Api/Repository/CollaboratorsTest.php @@ -16,7 +16,7 @@ public function shouldGetAllRepositoryCollaborators() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/collaborators') + ->with('/repos/KnpLabs/php-github-api/collaborators') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -32,7 +32,7 @@ public function shouldCheckIfRepositoryCollaborator() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/collaborators/l3l0') + ->with('/repos/KnpLabs/php-github-api/collaborators/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->check('KnpLabs', 'php-github-api', 'l3l0')); @@ -48,7 +48,7 @@ public function shouldAddRepositoryCollaborator() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('repos/KnpLabs/php-github-api/collaborators/l3l0') + ->with('/repos/KnpLabs/php-github-api/collaborators/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->add('KnpLabs', 'php-github-api', 'l3l0')); @@ -64,7 +64,7 @@ public function shouldRemoveRepositoryCollaborator() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/collaborators/l3l0') + ->with('/repos/KnpLabs/php-github-api/collaborators/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'php-github-api', 'l3l0')); diff --git a/test/Github/Tests/Api/Repository/CommentsTest.php b/test/Github/Tests/Api/Repository/CommentsTest.php index 586736a183f..6fea4a62a70 100644 --- a/test/Github/Tests/Api/Repository/CommentsTest.php +++ b/test/Github/Tests/Api/Repository/CommentsTest.php @@ -16,7 +16,7 @@ public function shouldGetAllRepositoryComments() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/comments') + ->with('/repos/KnpLabs/php-github-api/comments') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -32,7 +32,7 @@ public function shouldGetSpecificCommitRepositoryComments() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/commits/commitSHA123456/comments') + ->with('/repos/KnpLabs/php-github-api/commits/commitSHA123456/comments') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', 'commitSHA123456')); @@ -48,7 +48,7 @@ public function shouldShowComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/comments/123') + ->with('/repos/KnpLabs/php-github-api/comments/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 123)); @@ -80,7 +80,7 @@ public function shouldCreateRepositoryCommitComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/commits/commitSHA123456/comments', $data) + ->with('/repos/KnpLabs/php-github-api/commits/commitSHA123456/comments', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', 'commitSHA123456', $data)); @@ -97,7 +97,7 @@ public function shouldCreateRepositoryCommitCommentWithoutLine() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/commits/commitSHA123456/comments', $data) + ->with('/repos/KnpLabs/php-github-api/commits/commitSHA123456/comments', $data) ->will($this->returnValue($expectedValue)); $api->create('KnpLabs', 'php-github-api', 'commitSHA123456', $data); @@ -127,7 +127,7 @@ public function shouldUpdateComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/KnpLabs/php-github-api/comments/123', $data) + ->with('/repos/KnpLabs/php-github-api/comments/123', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpLabs', 'php-github-api', 123, $data)); @@ -143,7 +143,7 @@ public function shouldRemoveComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/comments/123') + ->with('/repos/KnpLabs/php-github-api/comments/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'php-github-api', 123)); diff --git a/test/Github/Tests/Api/Repository/CommitsTest.php b/test/Github/Tests/Api/Repository/CommitsTest.php index b36f81b16c0..395ee1ac259 100644 --- a/test/Github/Tests/Api/Repository/CommitsTest.php +++ b/test/Github/Tests/Api/Repository/CommitsTest.php @@ -17,7 +17,7 @@ public function shouldGetAllRepositoryCommits() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/commits', $data) + ->with('/repos/KnpLabs/php-github-api/commits', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', $data)); @@ -33,7 +33,7 @@ public function shouldCompareTwoCommits() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/compare/v3...HEAD') + ->with('/repos/KnpLabs/php-github-api/compare/v3...HEAD') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->compare('KnpLabs', 'php-github-api', 'v3', 'HEAD')); @@ -49,7 +49,7 @@ public function shouldShowCommitUsingSha() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/commits/123') + ->with('/repos/KnpLabs/php-github-api/commits/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 123)); diff --git a/test/Github/Tests/Api/Repository/ContentsTest.php b/test/Github/Tests/Api/Repository/ContentsTest.php index cc9bb693940..5be3b227ba6 100644 --- a/test/Github/Tests/Api/Repository/ContentsTest.php +++ b/test/Github/Tests/Api/Repository/ContentsTest.php @@ -18,7 +18,7 @@ public function shouldShowContentForGivenPath() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/contents/test%2FGithub%2FTests%2FApi%2FRepository%2FContentsTest.php', array('ref' => null)) + ->with('/repos/KnpLabs/php-github-api/contents/test%2FGithub%2FTests%2FApi%2FRepository%2FContentsTest.php', array('ref' => null)) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 'test/Github/Tests/Api/Repository/ContentsTest.php')); @@ -34,7 +34,7 @@ public function shouldShowReadme() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/readme', array('ref' => null)) + ->with('/repos/KnpLabs/php-github-api/readme', array('ref' => null)) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->readme('KnpLabs', 'php-github-api')); @@ -50,7 +50,7 @@ public function shouldReturnTrueWhenFileExists() $api = $this->getApiMock(); $api->expects($this->once()) ->method('head') - ->with('repos/KnpLabs/php-github-api/contents/composer.json', array('ref' => null)) + ->with('/repos/KnpLabs/php-github-api/contents/composer.json', array('ref' => null)) ->will($this->returnValue($response)); $this->assertEquals(true, $api->exists('KnpLabs', 'php-github-api', 'composer.json')); @@ -77,7 +77,7 @@ public function shouldReturnFalseWhenFileIsNotFound(\PHPUnit_Framework_MockObjec $api = $this->getApiMock(); $api->expects($this->once()) ->method('head') - ->with('repos/KnpLabs/php-github-api/contents/composer.json', array('ref' => null)) + ->with('/repos/KnpLabs/php-github-api/contents/composer.json', array('ref' => null)) ->will($failureStub); $this->assertFalse($api->exists('KnpLabs', 'php-github-api', 'composer.json')); @@ -92,7 +92,7 @@ public function shouldBubbleTwoFactorAuthenticationRequiredExceptionsWhenCheckin $api = $this->getApiMock(); $api->expects($this->once()) ->method('head') - ->with('repos/KnpLabs/php-github-api/contents/composer.json', array('ref' => null)) + ->with('/repos/KnpLabs/php-github-api/contents/composer.json', array('ref' => null)) ->will($this->throwException(new TwoFactorAuthenticationRequiredException(0))); $api->exists('KnpLabs', 'php-github-api', 'composer.json'); @@ -118,7 +118,7 @@ public function shouldCreateNewFile() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('repos/KnpLabs/php-github-api/contents/test%2FGithub%2FTests%2FApi%2FRepository%2FContentsTest.php', $parameters) + ->with('/repos/KnpLabs/php-github-api/contents/test%2FGithub%2FTests%2FApi%2FRepository%2FContentsTest.php', $parameters) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->create('KnpLabs', 'php-github-api', 'test/Github/Tests/Api/Repository/ContentsTest.php', $content, $message, $branch, $committer)); @@ -158,7 +158,7 @@ public function shouldUpdateFile() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('repos/KnpLabs/php-github-api/contents/test%2FGithub%2FTests%2FApi%2FRepository%2FContentsTest.php', $parameters) + ->with('/repos/KnpLabs/php-github-api/contents/test%2FGithub%2FTests%2FApi%2FRepository%2FContentsTest.php', $parameters) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update('KnpLabs', 'php-github-api', 'test/Github/Tests/Api/Repository/ContentsTest.php', $content, $message, $sha, $branch, $committer)); @@ -196,7 +196,7 @@ public function shouldDeleteFile() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/contents/test%2FGithub%2FTests%2FApi%2FRepository%2FContentsTest.php', $parameters) + ->with('/repos/KnpLabs/php-github-api/contents/test%2FGithub%2FTests%2FApi%2FRepository%2FContentsTest.php', $parameters) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->rm('KnpLabs', 'php-github-api', 'test/Github/Tests/Api/Repository/ContentsTest.php', $message, $sha, $branch, $committer)); @@ -224,7 +224,7 @@ public function shouldFetchTarballArchiveWhenFormatNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/tarball') + ->with('/repos/KnpLabs/php-github-api/tarball') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->archive('KnpLabs', 'php-github-api', 'someFormat')); @@ -240,7 +240,7 @@ public function shouldFetchTarballArchive() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/tarball') + ->with('/repos/KnpLabs/php-github-api/tarball') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->archive('KnpLabs', 'php-github-api', 'tarball')); @@ -256,7 +256,7 @@ public function shouldFetchZipballArchive() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/zipball') + ->with('/repos/KnpLabs/php-github-api/zipball') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->archive('KnpLabs', 'php-github-api', 'zipball')); @@ -272,7 +272,7 @@ public function shouldFetchZipballArchiveByReference() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/zipball/master') + ->with('/repos/KnpLabs/php-github-api/zipball/master') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->archive('KnpLabs', 'php-github-api', 'zipball', 'master')); @@ -292,7 +292,7 @@ public function shouldDownloadForGivenPath() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/contents/test%2FGithub%2FTests%2FApi%2FRepository%2FContentsTest.php', array('ref' => null)) + ->with('/repos/KnpLabs/php-github-api/contents/test%2FGithub%2FTests%2FApi%2FRepository%2FContentsTest.php', array('ref' => null)) ->will($this->returnValue($getValue)); $this->assertEquals($expectedValue, $api->download('KnpLabs', 'php-github-api', 'test/Github/Tests/Api/Repository/ContentsTest.php')); @@ -312,7 +312,7 @@ public function shouldDownloadForSpacedPath() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/mads379/scala.tmbundle/contents/Syntaxes%2FSimple%20Build%20Tool.tmLanguage', array('ref' => null)) + ->with('/repos/mads379/scala.tmbundle/contents/Syntaxes%2FSimple%20Build%20Tool.tmLanguage', array('ref' => null)) ->will($this->returnValue($getValue)); $this->assertEquals($expectedValue, $api->download('mads379', 'scala.tmbundle', 'Syntaxes/Simple Build Tool.tmLanguage')); diff --git a/test/Github/Tests/Api/Repository/DeployKeysTest.php b/test/Github/Tests/Api/Repository/DeployKeysTest.php index 1654471b69e..535ede4e5ab 100644 --- a/test/Github/Tests/Api/Repository/DeployKeysTest.php +++ b/test/Github/Tests/Api/Repository/DeployKeysTest.php @@ -16,7 +16,7 @@ public function shouldGetAllRepositoryDeployKeys() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/keys') + ->with('/repos/KnpLabs/php-github-api/keys') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -32,7 +32,7 @@ public function shouldShowDeployKey() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/keys/123') + ->with('/repos/KnpLabs/php-github-api/keys/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 123)); @@ -48,7 +48,7 @@ public function shouldRemoveDeployKey() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/keys/123') + ->with('/repos/KnpLabs/php-github-api/keys/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'php-github-api', 123)); @@ -95,7 +95,7 @@ public function shouldCreateDeployKey() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/keys', $data) + ->with('/repos/KnpLabs/php-github-api/keys', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); @@ -142,7 +142,7 @@ public function shouldUpdateDeployKey() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/KnpLabs/php-github-api/keys/123', $data) + ->with('/repos/KnpLabs/php-github-api/keys/123', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpLabs', 'php-github-api', 123, $data)); diff --git a/test/Github/Tests/Api/Repository/DownloadsTest.php b/test/Github/Tests/Api/Repository/DownloadsTest.php index b352c12efbf..ad7897cc8f7 100644 --- a/test/Github/Tests/Api/Repository/DownloadsTest.php +++ b/test/Github/Tests/Api/Repository/DownloadsTest.php @@ -16,7 +16,7 @@ public function shouldGetAllRepositoryDownloads() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/downloads') + ->with('/repos/KnpLabs/php-github-api/downloads') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -32,7 +32,7 @@ public function shouldShowRepositoryDownload() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/downloads/l3l0') + ->with('/repos/KnpLabs/php-github-api/downloads/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 'l3l0')); @@ -48,7 +48,7 @@ public function shouldRemoveRepositoryDownload() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/downloads/l3l0') + ->with('/repos/KnpLabs/php-github-api/downloads/l3l0') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'php-github-api', 'l3l0')); diff --git a/test/Github/Tests/Api/Repository/ForksTest.php b/test/Github/Tests/Api/Repository/ForksTest.php index 151fbc3837b..12530a98647 100644 --- a/test/Github/Tests/Api/Repository/ForksTest.php +++ b/test/Github/Tests/Api/Repository/ForksTest.php @@ -16,7 +16,7 @@ public function shouldGetForks() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/forks', array('page' => 1)) + ->with('/repos/KnpLabs/php-github-api/forks', array('page' => 1)) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -33,7 +33,7 @@ public function shouldCreateFork() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/forks', $data) + ->with('/repos/KnpLabs/php-github-api/forks', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); @@ -49,7 +49,7 @@ public function shouldSortByNewestWhenSortParamNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/forks', array('page' => 1, 'sort' => 'newest')) + ->with('/repos/KnpLabs/php-github-api/forks', array('page' => 1, 'sort' => 'newest')) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', array('sort' => 'oldes'))); diff --git a/test/Github/Tests/Api/Repository/HooksTest.php b/test/Github/Tests/Api/Repository/HooksTest.php index aa8e32b485d..dfe2d77b083 100644 --- a/test/Github/Tests/Api/Repository/HooksTest.php +++ b/test/Github/Tests/Api/Repository/HooksTest.php @@ -16,7 +16,7 @@ public function shouldGetAllRepositoryHooks() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/hooks') + ->with('/repos/KnpLabs/php-github-api/hooks') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -32,7 +32,7 @@ public function shouldShowHook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/hooks/123') + ->with('/repos/KnpLabs/php-github-api/hooks/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 123)); @@ -48,7 +48,7 @@ public function shouldRemoveHook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/hooks/123') + ->with('/repos/KnpLabs/php-github-api/hooks/123') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'php-github-api', 123)); @@ -95,7 +95,7 @@ public function shouldCreateHook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/hooks', $data) + ->with('/repos/KnpLabs/php-github-api/hooks', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); @@ -142,7 +142,7 @@ public function shouldUpdateHook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/KnpLabs/php-github-api/hooks/123', $data) + ->with('/repos/KnpLabs/php-github-api/hooks/123', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpLabs', 'php-github-api', 123, $data)); @@ -158,7 +158,7 @@ public function shouldTestHook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/hooks/123/test') + ->with('/repos/KnpLabs/php-github-api/hooks/123/test') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->test('KnpLabs', 'php-github-api', 123)); diff --git a/test/Github/Tests/Api/Repository/LabelsTest.php b/test/Github/Tests/Api/Repository/LabelsTest.php index 8b430e6b3f1..7e81cea8188 100644 --- a/test/Github/Tests/Api/Repository/LabelsTest.php +++ b/test/Github/Tests/Api/Repository/LabelsTest.php @@ -16,7 +16,7 @@ public function shouldGetAllRepositoryLabelss() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/labels') + ->with('/repos/KnpLabs/php-github-api/labels') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -32,7 +32,7 @@ public function shouldShowLabel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/labels/somename') + ->with('/repos/KnpLabs/php-github-api/labels/somename') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 'somename')); @@ -48,7 +48,7 @@ public function shouldRemoveLabel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/labels/somename') + ->with('/repos/KnpLabs/php-github-api/labels/somename') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'php-github-api', 'somename')); @@ -95,7 +95,7 @@ public function shouldCreateLabel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/labels', $data) + ->with('/repos/KnpLabs/php-github-api/labels', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); @@ -142,7 +142,7 @@ public function shouldUpdateLabel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/KnpLabs/php-github-api/labels/labelName', $data) + ->with('/repos/KnpLabs/php-github-api/labels/labelName', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->update('KnpLabs', 'php-github-api', 'labelName', $data)); diff --git a/test/Github/Tests/Api/Repository/ReleasesTest.php b/test/Github/Tests/Api/Repository/ReleasesTest.php index f9188e137a0..a05d0bdc422 100644 --- a/test/Github/Tests/Api/Repository/ReleasesTest.php +++ b/test/Github/Tests/Api/Repository/ReleasesTest.php @@ -16,7 +16,7 @@ public function shouldGetLatestRelease() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/releases/latest') + ->with('/repos/KnpLabs/php-github-api/releases/latest') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->latest('KnpLabs', 'php-github-api')); @@ -32,7 +32,7 @@ public function shouldGetReleaseByTag() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/releases/tags/5f078080e01e0365690920d618f12342d2c941c8') + ->with('/repos/KnpLabs/php-github-api/releases/tags/5f078080e01e0365690920d618f12342d2c941c8') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->tag( @@ -52,7 +52,7 @@ public function shouldGetAllRepositoryReleases() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/releases') + ->with('/repos/KnpLabs/php-github-api/releases') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -69,7 +69,7 @@ public function shouldGetSingleRepositoryRelease() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/releases/'.$id) + ->with('/repos/KnpLabs/php-github-api/releases/'.$id) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', $id)); @@ -86,7 +86,7 @@ public function shouldCreateRepositoryRelease() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/releases') + ->with('/repos/KnpLabs/php-github-api/releases') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data)); @@ -119,7 +119,7 @@ public function shouldEditRepositoryRelease() $api = $this->getApiMock(); $api->expects($this->once()) ->method('patch') - ->with('repos/KnpLabs/php-github-api/releases/'.$id) + ->with('/repos/KnpLabs/php-github-api/releases/'.$id) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->edit('KnpLabs', 'php-github-api', $id, $data)); @@ -136,7 +136,7 @@ public function shouldRemoveRepositoryRelease() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('repos/KnpLabs/php-github-api/releases/'.$id) + ->with('/repos/KnpLabs/php-github-api/releases/'.$id) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->remove('KnpLabs', 'php-github-api', $id)); diff --git a/test/Github/Tests/Api/Repository/StargazersTest.php b/test/Github/Tests/Api/Repository/StargazersTest.php index e9c2dbbb50c..142ce8ba6c7 100644 --- a/test/Github/Tests/Api/Repository/StargazersTest.php +++ b/test/Github/Tests/Api/Repository/StargazersTest.php @@ -16,7 +16,7 @@ public function shouldGetAllRepositoryStargazers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/stargazers') + ->with('/repos/KnpLabs/php-github-api/stargazers') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api')); @@ -32,7 +32,7 @@ public function shouldGetAllRepositoryStargazersWithAlternativeResponse() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/stargazers') + ->with('/repos/KnpLabs/php-github-api/stargazers') ->will($this->returnValue($expectedValue)); $api->configure('star'); diff --git a/test/Github/Tests/Api/Repository/StatusesTest.php b/test/Github/Tests/Api/Repository/StatusesTest.php index 68667fca7b1..55d96af0bf1 100644 --- a/test/Github/Tests/Api/Repository/StatusesTest.php +++ b/test/Github/Tests/Api/Repository/StatusesTest.php @@ -19,7 +19,7 @@ public function shouldShowCommitStatuses() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/commits/commitSHA123456/statuses') + ->with('/repos/KnpLabs/php-github-api/commits/commitSHA123456/statuses') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->show('KnpLabs', 'php-github-api', 'commitSHA123456')); @@ -49,7 +49,7 @@ public function shouldShowCombinedCommitStatuses() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('repos/KnpLabs/php-github-api/commits/commitSHA123456/status') + ->with('/repos/KnpLabs/php-github-api/commits/commitSHA123456/status') ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->combined('KnpLabs', 'php-github-api', 'commitSHA123456')); @@ -81,7 +81,7 @@ public function shouldCreateCommitStatus() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('repos/KnpLabs/php-github-api/statuses/commitSHA123456', $data) + ->with('/repos/KnpLabs/php-github-api/statuses/commitSHA123456', $data) ->will($this->returnValue($expectedValue)); $this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', 'commitSHA123456', $data)); diff --git a/test/Github/Tests/Api/SearchTest.php b/test/Github/Tests/Api/SearchTest.php index d5c41f2e0ed..d5fe9b08494 100644 --- a/test/Github/Tests/Api/SearchTest.php +++ b/test/Github/Tests/Api/SearchTest.php @@ -16,7 +16,7 @@ public function shouldSearchRepositoriesByQuery() $api->expects($this->once()) ->method('get') ->with( - 'search/repositories', + '/search/repositories', array('q' => 'query text', 'sort' => 'updated', 'order' => 'desc') ) ->will($this->returnValue($expectedArray)); @@ -36,7 +36,7 @@ public function shouldSearchRepositoriesRegardingSortAndOrder() $api->expects($this->once()) ->method('get') ->with( - 'search/repositories', + '/search/repositories', array('q' => 'query text', 'sort' => 'created', 'order' => 'asc') ) ->will($this->returnValue($expectedArray)); @@ -59,7 +59,7 @@ public function shouldSearchIssuesByQuery() $api->expects($this->once()) ->method('get') ->with( - 'search/issues', + '/search/issues', array('q' => 'query text', 'sort' => 'updated', 'order' => 'desc') ) ->will($this->returnValue($expectedArray)); @@ -79,7 +79,7 @@ public function shouldSearchIssuesRegardingSortAndOrder() $api->expects($this->once()) ->method('get') ->with( - 'search/issues', + '/search/issues', array('q' => 'query text', 'sort' => 'created', 'order' => 'asc') ) ->will($this->returnValue($expectedArray)); @@ -102,7 +102,7 @@ public function shouldSearchCodeByQuery() $api->expects($this->once()) ->method('get') ->with( - 'search/code', + '/search/code', array('q' => 'query text', 'sort' => 'updated', 'order' => 'desc') ) ->will($this->returnValue($expectedArray)); @@ -122,7 +122,7 @@ public function shouldSearchCodeRegardingSortAndOrder() $api->expects($this->once()) ->method('get') ->with( - 'search/code', + '/search/code', array('q' => 'query text', 'sort' => 'created', 'order' => 'asc') ) ->will($this->returnValue($expectedArray)); @@ -145,7 +145,7 @@ public function shouldSearchUsersByQuery() $api->expects($this->once()) ->method('get') ->with( - 'search/users', + '/search/users', array('q' => 'query text', 'sort' => 'updated', 'order' => 'desc') ) ->will($this->returnValue($expectedArray)); @@ -165,7 +165,7 @@ public function shouldSearchUsersRegardingSortAndOrder() $api->expects($this->once()) ->method('get') ->with( - 'search/users', + '/search/users', array('q' => 'query text', 'sort' => 'created', 'order' => 'asc') ) ->will($this->returnValue($expectedArray)); diff --git a/test/Github/Tests/Api/UserTest.php b/test/Github/Tests/Api/UserTest.php index dec69d7944b..6f4f4e9fc00 100644 --- a/test/Github/Tests/Api/UserTest.php +++ b/test/Github/Tests/Api/UserTest.php @@ -14,7 +14,7 @@ public function shouldShowUser() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('users/l3l0') + ->with('/users/l3l0') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show('l3l0')); @@ -37,7 +37,7 @@ public function shouldGetUserOrganizations() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('users/l3l0/orgs') + ->with('/users/l3l0/orgs') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->organizations('l3l0')); @@ -56,7 +56,7 @@ public function shouldGetAllUsers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('users') + ->with('/users') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->all()); @@ -75,7 +75,7 @@ public function shouldSearchUsers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('legacy/user/search/l3l0') + ->with('/legacy/user/search/l3l0') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->find('l3l0')); @@ -91,7 +91,7 @@ public function shouldGetFollowingUsers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('users/l3l0/following') + ->with('/users/l3l0/following') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->following('l3l0')); @@ -107,7 +107,7 @@ public function shouldGetUserFollowers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('users/l3l0/followers') + ->with('/users/l3l0/followers') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->followers('l3l0')); @@ -123,7 +123,7 @@ public function shouldGetSubscriptionsToRepositories() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('users/l3l0/subscriptions') + ->with('/users/l3l0/subscriptions') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->subscriptions('l3l0')); @@ -139,7 +139,7 @@ public function shouldGetUserRepositories() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('users/l3l0/repos', array('type' => 'owner', 'sort' => 'full_name', 'direction' => 'asc')) + ->with('/users/l3l0/repos', array('type' => 'owner', 'sort' => 'full_name', 'direction' => 'asc')) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->repositories('l3l0')); @@ -155,7 +155,7 @@ public function shouldGetUserGists() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('users/l3l0/gists') + ->with('/users/l3l0/gists') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->gists('l3l0'));