From 2b320f76baafadf2715cfb92358f793e383d923d Mon Sep 17 00:00:00 2001 From: Matt Humphrey Date: Wed, 6 May 2015 15:58:16 +0100 Subject: [PATCH] Handle dots and slashes when encoding. Fixes #86 #87 --- lib/Gitlab/Api/AbstractApi.php | 13 +++++++++++- lib/Gitlab/Api/Groups.php | 16 +++++++-------- lib/Gitlab/Api/Issues.php | 12 +++++------ lib/Gitlab/Api/MergeRequests.php | 12 +++++------ lib/Gitlab/Api/Milestones.php | 6 +++--- lib/Gitlab/Api/Projects.php | 28 +++++++++++++------------- lib/Gitlab/Api/Repositories.php | 20 +++++++++--------- lib/Gitlab/Api/Snippets.php | 8 ++++---- lib/Gitlab/Api/SystemHooks.php | 4 ++-- lib/Gitlab/Api/Users.php | 18 ++++++++--------- test/Gitlab/Tests/Api/ProjectsTest.php | 7 ++++++- 11 files changed, 80 insertions(+), 64 deletions(-) diff --git a/lib/Gitlab/Api/AbstractApi.php b/lib/Gitlab/Api/AbstractApi.php index 7bf3f562e..a043ed98e 100644 --- a/lib/Gitlab/Api/AbstractApi.php +++ b/lib/Gitlab/Api/AbstractApi.php @@ -111,6 +111,17 @@ protected function delete($path, array $parameters = array(), $requestHeaders = */ protected function getProjectPath($id, $path) { - return 'projects/'.rawurlencode($id).'/'.$path; + return 'projects/'.$this->encodePath($id).'/'.$path; + } + + /** + * @param string $path + * @return string + */ + protected function encodePath($path) + { + $path = rawurlencode($path); + + return str_replace(array('%2F', '.'), array('/', '%2E'), $path); } } diff --git a/lib/Gitlab/Api/Groups.php b/lib/Gitlab/Api/Groups.php index 10060d913..551034f9a 100644 --- a/lib/Gitlab/Api/Groups.php +++ b/lib/Gitlab/Api/Groups.php @@ -23,7 +23,7 @@ public function all($page = 1, $per_page = self::PER_PAGE) */ public function search($query, $page = 1, $per_page = self::PER_PAGE) { - return $this->get('groups?search='.rawurlencode($query), array( + return $this->get('groups?search='.$this->encodePath($query), array( 'page' => $page, 'per_page' => $per_page )); @@ -35,7 +35,7 @@ public function search($query, $page = 1, $per_page = self::PER_PAGE) */ public function show($id) { - return $this->get('groups/'.rawurlencode($id)); + return $this->get('groups/'.$this->encodePath($id)); } /** @@ -59,7 +59,7 @@ public function create($name, $path, $description = null) */ public function remove($group_id) { - return $this->delete('groups/'.rawurlencode($group_id)); + return $this->delete('groups/'.$this->encodePath($group_id)); } /** @@ -69,7 +69,7 @@ public function remove($group_id) */ public function transfer($group_id, $project_id) { - return $this->post('groups/'.rawurlencode($group_id).'/projects/'.rawurlencode($project_id)); + return $this->post('groups/'.$this->encodePath($group_id).'/projects/'.$this->encodePath($project_id)); } /** @@ -80,7 +80,7 @@ public function transfer($group_id, $project_id) */ public function members($id, $page = 1, $per_page = self::PER_PAGE) { - return $this->get('groups/'.rawurlencode($id).'/members', array( + return $this->get('groups/'.$this->encodePath($id).'/members', array( 'page' => $page, 'per_page' => $per_page )); @@ -94,7 +94,7 @@ public function members($id, $page = 1, $per_page = self::PER_PAGE) */ public function addMember($group_id, $user_id, $access_level) { - return $this->post('groups/'.rawurlencode($group_id).'/members', array( + return $this->post('groups/'.$this->encodePath($group_id).'/members', array( 'user_id' => $user_id, 'access_level' => $access_level )); @@ -108,7 +108,7 @@ public function addMember($group_id, $user_id, $access_level) */ public function saveMember($group_id, $user_id, $access_level) { - return $this->put('groups/'.rawurlencode($group_id).'/members/'.rawurlencode($user_id), array( + return $this->put('groups/'.$this->encodePath($group_id).'/members/'.$this->encodePath($user_id), array( 'access_level' => $access_level )); } @@ -120,6 +120,6 @@ public function saveMember($group_id, $user_id, $access_level) */ public function removeMember($group_id, $user_id) { - return $this->delete('groups/'.rawurlencode($group_id).'/members/'.rawurlencode($user_id)); + return $this->delete('groups/'.$this->encodePath($group_id).'/members/'.$this->encodePath($user_id)); } } diff --git a/lib/Gitlab/Api/Issues.php b/lib/Gitlab/Api/Issues.php index 095209924..86dd78b4b 100644 --- a/lib/Gitlab/Api/Issues.php +++ b/lib/Gitlab/Api/Issues.php @@ -29,7 +29,7 @@ public function all($project_id = null, $page = 1, $per_page = self::PER_PAGE, a */ public function show($project_id, $issue_id) { - return $this->get($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id))); + return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id))); } /** @@ -50,7 +50,7 @@ public function create($project_id, array $params) */ public function update($project_id, $issue_id, array $params) { - return $this->put($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id)), $params); + return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)), $params); } /** @@ -60,7 +60,7 @@ public function update($project_id, $issue_id, array $params) */ public function showComments($project_id, $issue_id) { - return $this->get($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id)).'/notes'); + return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)).'/notes'); } /** @@ -71,7 +71,7 @@ public function showComments($project_id, $issue_id) */ public function showComment($project_id, $issue_id, $note_id) { - return $this->get($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id)).'/notes/'.rawurlencode($note_id)); + return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)).'/notes/'.$this->encodePath($note_id)); } /** @@ -89,7 +89,7 @@ public function addComment($project_id, $issue_id, $body) $params = array('body' => $body); } - return $this->post($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id).'/notes'), $params); + return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/notes'), $params); } /** @@ -101,7 +101,7 @@ public function addComment($project_id, $issue_id, $body) */ public function updateComment($project_id, $issue_id, $note_id, $body) { - return $this->put($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id).'/notes/'.rawurlencode($note_id)), array( + return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/notes/'.$this->encodePath($note_id)), array( 'body' => $body )); } diff --git a/lib/Gitlab/Api/MergeRequests.php b/lib/Gitlab/Api/MergeRequests.php index 81188504c..292a4c21d 100644 --- a/lib/Gitlab/Api/MergeRequests.php +++ b/lib/Gitlab/Api/MergeRequests.php @@ -89,7 +89,7 @@ public function closed($project_id, $page = 1, $per_page = self::PER_PAGE, $orde */ public function show($project_id, $mr_id) { - return $this->get($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id))); + return $this->get($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id))); } /** @@ -122,7 +122,7 @@ public function create($project_id, $source, $target, $title, $assignee = null, */ public function update($project_id, $mr_id, array $params) { - return $this->put($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id)), $params); + return $this->put($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id)), $params); } /** @@ -139,7 +139,7 @@ public function merge($project_id, $mr_id, $message = null) $params = array('merge_commit_message' => $message); } - return $this->put($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id).'/merge'), $params); + return $this->put($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id).'/merge'), $params); } /** @@ -149,7 +149,7 @@ public function merge($project_id, $mr_id, $message = null) */ public function showComments($project_id, $mr_id) { - return $this->get($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id).'/comments')); + return $this->get($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id).'/comments')); } /** @@ -160,7 +160,7 @@ public function showComments($project_id, $mr_id) */ public function addComment($project_id, $mr_id, $note) { - return $this->post($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id).'/comments'), array( + return $this->post($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id).'/comments'), array( 'note' => $note )); } @@ -172,6 +172,6 @@ public function addComment($project_id, $mr_id, $note) */ public function changes($project_id, $mr_id) { - return $this->get($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id).'/changes')); + return $this->get($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id).'/changes')); } } diff --git a/lib/Gitlab/Api/Milestones.php b/lib/Gitlab/Api/Milestones.php index 714d80685..3b1528183 100644 --- a/lib/Gitlab/Api/Milestones.php +++ b/lib/Gitlab/Api/Milestones.php @@ -23,7 +23,7 @@ public function all($project_id, $page = 1, $per_page = self::PER_PAGE) */ public function show($project_id, $milestone_id) { - return $this->get($this->getProjectPath($project_id, 'milestones/'.rawurlencode($milestone_id))); + return $this->get($this->getProjectPath($project_id, 'milestones/'.$this->encodePath($milestone_id))); } /** @@ -44,7 +44,7 @@ public function create($project_id, array $params) */ public function update($project_id, $milestone_id, array $params) { - return $this->put($this->getProjectPath($project_id, 'milestones/'.rawurlencode($milestone_id)), $params); + return $this->put($this->getProjectPath($project_id, 'milestones/'.$this->encodePath($milestone_id)), $params); } /** @@ -54,6 +54,6 @@ public function update($project_id, $milestone_id, array $params) */ public function issues($project_id, $milestone_id) { - return $this->get($this->getProjectPath($project_id, 'milestones/'.rawurlencode($milestone_id).'/issues')); + return $this->get($this->getProjectPath($project_id, 'milestones/'.$this->encodePath($milestone_id).'/issues')); } } diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index ca5f2f56d..45104d508 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -66,7 +66,7 @@ public function owned($page = 1, $per_page = self::PER_PAGE, $order_by = self::O */ public function search($query, $page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT) { - return $this->get('projects/search/'.rawurlencode($query), array( + return $this->get('projects/search/'.$this->encodePath($query), array( 'page' => $page, 'per_page' => $per_page, 'order_by' => $order_by, @@ -80,7 +80,7 @@ public function search($query, $page = 1, $per_page = self::PER_PAGE, $order_by */ public function show($project_id) { - return $this->get('projects/'.rawurlencode($project_id)); + return $this->get('projects/'.$this->encodePath($project_id)); } /** @@ -105,7 +105,7 @@ public function createForUser($user_id, $name, array $params = array()) { $params['name'] = $name; - return $this->post('projects/user/'.rawurlencode($user_id), $params); + return $this->post('projects/user/'.$this->encodePath($user_id), $params); } /** @@ -115,7 +115,7 @@ public function createForUser($user_id, $name, array $params = array()) */ public function update($project_id, array $params) { - return $this->put('projects/'.rawurlencode($project_id), $params); + return $this->put('projects/'.$this->encodePath($project_id), $params); } /** @@ -124,7 +124,7 @@ public function update($project_id, array $params) */ public function remove($project_id) { - return $this->delete('projects/'.rawurlencode($project_id)); + return $this->delete('projects/'.$this->encodePath($project_id)); } /** @@ -146,7 +146,7 @@ public function members($project_id, $username_query = null) */ public function member($project_id, $user_id) { - return $this->get($this->getProjectPath($project_id, 'members/'.rawurlencode($user_id))); + return $this->get($this->getProjectPath($project_id, 'members/'.$this->encodePath($user_id))); } /** @@ -207,7 +207,7 @@ public function hooks($project_id, $page = 1, $per_page = self::PER_PAGE) */ public function hook($project_id, $hook_id) { - return $this->get($this->getProjectPath($project_id, 'hooks/'.rawurlencode($hook_id))); + return $this->get($this->getProjectPath($project_id, 'hooks/'.$this->encodePath($hook_id))); } /** @@ -235,7 +235,7 @@ public function addHook($project_id, $url, array $params = array()) */ public function updateHook($project_id, $hook_id, array $params) { - return $this->put($this->getProjectPath($project_id, 'hooks/'.rawurlencode($hook_id)), $params); + return $this->put($this->getProjectPath($project_id, 'hooks/'.$this->encodePath($hook_id)), $params); } /** @@ -245,7 +245,7 @@ public function updateHook($project_id, $hook_id, array $params) */ public function removeHook($project_id, $hook_id) { - return $this->delete($this->getProjectPath($project_id, 'hooks/'.rawurlencode($hook_id))); + return $this->delete($this->getProjectPath($project_id, 'hooks/'.$this->encodePath($hook_id))); } /** @@ -264,7 +264,7 @@ public function keys($project_id) */ public function key($project_id, $key_id) { - return $this->get($this->getProjectPath($project_id, 'keys/'.rawurlencode($key_id))); + return $this->get($this->getProjectPath($project_id, 'keys/'.$this->encodePath($key_id))); } /** @@ -288,7 +288,7 @@ public function addKey($project_id, $title, $key) */ public function removeKey($project_id, $key_id) { - return $this->delete($this->getProjectPath($project_id, 'keys/'.rawurlencode($key_id))); + return $this->delete($this->getProjectPath($project_id, 'keys/'.$this->encodePath($key_id))); } /** @@ -353,7 +353,7 @@ public function removeLabel($project_id, $name) */ public function createForkRelation($project_id, $forked_project_id) { - return $this->post($this->getProjectPath($project_id, 'fork/'.rawurlencode($forked_project_id))); + return $this->post($this->getProjectPath($project_id, 'fork/'.$this->encodePath($forked_project_id))); } /** @@ -373,7 +373,7 @@ public function removeForkRelation($project_id) */ public function setService($project_id, $service_name, array $params = array()) { - return $this->put($this->getProjectPath($project_id, 'services/'.rawurlencode($service_name)), $params); + return $this->put($this->getProjectPath($project_id, 'services/'.$this->encodePath($service_name)), $params); } /** @@ -383,6 +383,6 @@ public function setService($project_id, $service_name, array $params = array()) */ public function removeService($project_id, $service_name) { - return $this->delete($this->getProjectPath($project_id, 'services/'.rawurlencode($service_name))); + return $this->delete($this->getProjectPath($project_id, 'services/'.$this->encodePath($service_name))); } } diff --git a/lib/Gitlab/Api/Repositories.php b/lib/Gitlab/Api/Repositories.php index e6187d8a9..0b37ea175 100644 --- a/lib/Gitlab/Api/Repositories.php +++ b/lib/Gitlab/Api/Repositories.php @@ -18,7 +18,7 @@ public function branches($project_id) */ public function branch($project_id, $branch_id) { - return $this->get($this->getProjectPath($project_id, 'repository/branches/'.rawurlencode($branch_id))); + return $this->get($this->getProjectPath($project_id, 'repository/branches/'.$this->encodePath($branch_id))); } /** @@ -42,7 +42,7 @@ public function createBranch($project_id, $branch_name, $ref) */ public function deleteBranch($project_id, $branch_name) { - return $this->delete($this->getProjectPath($project_id, 'repository/branches/'.rawurlencode($branch_name))); + return $this->delete($this->getProjectPath($project_id, 'repository/branches/'.$this->encodePath($branch_name))); } /** @@ -52,7 +52,7 @@ public function deleteBranch($project_id, $branch_name) */ public function protectBranch($project_id, $branch_name) { - return $this->put($this->getProjectPath($project_id, 'repository/branches/'.rawurlencode($branch_name).'/protect')); + return $this->put($this->getProjectPath($project_id, 'repository/branches/'.$this->encodePath($branch_name).'/protect')); } /** @@ -62,7 +62,7 @@ public function protectBranch($project_id, $branch_name) */ public function unprotectBranch($project_id, $branch_name) { - return $this->put($this->getProjectPath($project_id, 'repository/branches/'.rawurlencode($branch_name).'/unprotect')); + return $this->put($this->getProjectPath($project_id, 'repository/branches/'.$this->encodePath($branch_name).'/unprotect')); } /** @@ -113,7 +113,7 @@ public function commits($project_id, $page = 0, $per_page = self::PER_PAGE, $ref */ public function commit($project_id, $sha) { - return $this->get($this->getProjectPath($project_id, 'repository/commits/'.rawurlencode($sha))); + return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha))); } /** @@ -125,7 +125,7 @@ public function commit($project_id, $sha) */ public function commitComments($project_id, $sha, $page = 0, $per_page = self::PER_PAGE) { - return $this->get($this->getProjectPath($project_id, 'repository/commits/'.rawurlencode($sha).'/comments'), array( + return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha).'/comments'), array( 'page' => $page, 'per_page' => $per_page )); @@ -142,7 +142,7 @@ public function createCommitComment($project_id, $sha, $note, array $params = ar { $params['note'] = $note; - return $this->post($this->getProjectPath($project_id, 'repository/commits/'.rawurlencode($sha).'/comments'), $params); + return $this->post($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha).'/comments'), $params); } /** @@ -155,7 +155,7 @@ public function compare($project_id, $fromShaOrMaster, $toShaOrMaster) { return $this->get($this->getProjectPath( $project_id, - 'repository/compare?from='.rawurlencode($fromShaOrMaster).'&to='.rawurlencode($toShaOrMaster) + 'repository/compare?from='.$this->encodePath($fromShaOrMaster).'&to='.$this->encodePath($toShaOrMaster) )); } @@ -166,7 +166,7 @@ public function compare($project_id, $fromShaOrMaster, $toShaOrMaster) */ public function diff($project_id, $sha) { - return $this->get($this->getProjectPath($project_id, 'repository/commits/'.rawurlencode($sha).'/diff')); + return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha).'/diff')); } /** @@ -187,7 +187,7 @@ public function tree($project_id, array $params = array()) */ public function blob($project_id, $sha, $filepath) { - return $this->get($this->getProjectPath($project_id, 'repository/commits/'.rawurlencode($sha).'/blob'), array( + return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha).'/blob'), array( 'filepath' => $filepath )); } diff --git a/lib/Gitlab/Api/Snippets.php b/lib/Gitlab/Api/Snippets.php index e97b8727d..00921128c 100644 --- a/lib/Gitlab/Api/Snippets.php +++ b/lib/Gitlab/Api/Snippets.php @@ -18,7 +18,7 @@ public function all($project_id) */ public function show($project_id, $snippet_id) { - return $this->get($this->getProjectPath($project_id, 'snippets/'.rawurlencode($snippet_id))); + return $this->get($this->getProjectPath($project_id, 'snippets/'.$this->encodePath($snippet_id))); } /** @@ -45,7 +45,7 @@ public function create($project_id, $title, $filename, $code) */ public function update($project_id, $snippet_id, array $params) { - return $this->put($this->getProjectPath($project_id, 'snippets/'.rawurlencode($snippet_id)), $params); + return $this->put($this->getProjectPath($project_id, 'snippets/'.$this->encodePath($snippet_id)), $params); } /** @@ -55,7 +55,7 @@ public function update($project_id, $snippet_id, array $params) */ public function content($project_id, $snippet_id) { - return $this->get($this->getProjectPath($project_id, 'snippets/'.rawurlencode($snippet_id).'/raw')); + return $this->get($this->getProjectPath($project_id, 'snippets/'.$this->encodePath($snippet_id).'/raw')); } /** @@ -65,6 +65,6 @@ public function content($project_id, $snippet_id) */ public function remove($project_id, $snippet_id) { - return $this->delete($this->getProjectPath($project_id, 'snippets/'.rawurlencode($snippet_id))); + return $this->delete($this->getProjectPath($project_id, 'snippets/'.$this->encodePath($snippet_id))); } } diff --git a/lib/Gitlab/Api/SystemHooks.php b/lib/Gitlab/Api/SystemHooks.php index 1fb32be40..b21fd0908 100644 --- a/lib/Gitlab/Api/SystemHooks.php +++ b/lib/Gitlab/Api/SystemHooks.php @@ -27,7 +27,7 @@ public function create($url) */ public function test($id) { - return $this->get('hooks/'.rawurlencode($id)); + return $this->get('hooks/'.$this->encodePath($id)); } /** @@ -36,6 +36,6 @@ public function test($id) */ public function remove($id) { - return $this->delete('hooks/'.rawurlencode($id)); + return $this->delete('hooks/'.$this->encodePath($id)); } } diff --git a/lib/Gitlab/Api/Users.php b/lib/Gitlab/Api/Users.php index 0436ed99a..0675c1f15 100644 --- a/lib/Gitlab/Api/Users.php +++ b/lib/Gitlab/Api/Users.php @@ -40,7 +40,7 @@ public function search($query, $active = null, $page = 1, $per_page = self::PER_ */ public function show($id) { - return $this->get('users/'.rawurlencode($id)); + return $this->get('users/'.$this->encodePath($id)); } /** @@ -64,7 +64,7 @@ public function create($email, $password, array $params = array()) */ public function update($id, array $params) { - return $this->put('users/'.rawurlencode($id), $params); + return $this->put('users/'.$this->encodePath($id), $params); } /** @@ -73,7 +73,7 @@ public function update($id, array $params) */ public function remove($id) { - return $this->delete('users/'.rawurlencode($id)); + return $this->delete('users/'.$this->encodePath($id)); } /** @@ -122,7 +122,7 @@ public function keys() */ public function key($id) { - return $this->get('user/keys/'.rawurlencode($id)); + return $this->get('user/keys/'.$this->encodePath($id)); } /** @@ -144,7 +144,7 @@ public function createKey($title, $key) */ public function removeKey($id) { - return $this->delete('user/keys/'.rawurlencode($id)); + return $this->delete('user/keys/'.$this->encodePath($id)); } /** @@ -153,7 +153,7 @@ public function removeKey($id) */ public function userKeys($user_id) { - return $this->get('users/'.rawurlencode($user_id).'/keys'); + return $this->get('users/'.$this->encodePath($user_id).'/keys'); } /* @@ -163,7 +163,7 @@ public function userKeys($user_id) */ public function userKey($user_id, $key_id) { - return $this->get('users/'.rawurlencode($user_id).'/keys/'.rawurlencode($key_id)); + return $this->get('users/'.$this->encodePath($user_id).'/keys/'.$this->encodePath($key_id)); } /** @@ -174,7 +174,7 @@ public function userKey($user_id, $key_id) */ public function createKeyForUser($user_id, $title, $key) { - return $this->post('users/'.rawurlencode($user_id).'/keys', array( + return $this->post('users/'.$this->encodePath($user_id).'/keys', array( 'title' => $title, 'key' => $key )); @@ -187,6 +187,6 @@ public function createKeyForUser($user_id, $title, $key) */ public function removeUserKey($user_id, $key_id) { - return $this->delete('users/'.rawurlencode($user_id).'/keys/'.rawurlencode($key_id)); + return $this->delete('users/'.$this->encodePath($user_id).'/keys/'.$this->encodePath($key_id)); } } diff --git a/test/Gitlab/Tests/Api/ProjectsTest.php b/test/Gitlab/Tests/Api/ProjectsTest.php index 161973e87..5ecf5100e 100644 --- a/test/Gitlab/Tests/Api/ProjectsTest.php +++ b/test/Gitlab/Tests/Api/ProjectsTest.php @@ -78,8 +78,13 @@ public function shouldSearchProjects() $expectedArray = $this->getMultipleProjectsData(); $api = $this->getMultipleProjectsRequestMock('projects/search/a%20project', $expectedArray); - $this->assertEquals($expectedArray, $api->search('a project')); + + $api = $this->getMultipleProjectsRequestMock('projects/search/a%2Eproject', $expectedArray); + $this->assertEquals($expectedArray, $api->search('a.project')); + + $api = $this->getMultipleProjectsRequestMock('projects/search/a/project', $expectedArray); + $this->assertEquals($expectedArray, $api->search('a/project')); } /**