Skip to content

Commit cf962cb

Browse files
authored
bug KnpLabs#985 Replace deprecated organization team repository add/remove urls (acrobat)
This PR was merged into the 2.x branch. Discussion ---------- Fixes KnpLabs#921 Commits ------- 251e5b7 Replace deprecated organization team repository add/remove urls
2 parents 298bb46 + 251e5b7 commit cf962cb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/Github/Api/Organization/Teams.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,15 @@ public function repository($team, $organization, $repository)
149149

150150
public function addRepository($team, $organization, $repository, $params = [])
151151
{
152-
if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'admin'])) {
152+
if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'admin', 'maintain', 'triage'])) {
153153
$params['permission'] = 'pull';
154154
}
155155

156-
return $this->put('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository), $params);
156+
return $this->put('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository), $params);
157157
}
158158

159159
public function removeRepository($team, $organization, $repository)
160160
{
161-
return $this->delete('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository));
161+
return $this->delete('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository));
162162
}
163163
}

test/Github/Tests/Api/Organization/TeamsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function shouldAddTeamRepository()
161161
$api = $this->getApiMock();
162162
$api->expects($this->once())
163163
->method('put')
164-
->with('/teams/KnpWorld/repos/l3l0/l3l0Repo')
164+
->with('/orgs/l3l0/teams/KnpWorld/repos/l3l0/l3l0Repo')
165165
->will($this->returnValue($expectedValue));
166166

167167
$this->assertEquals($expectedValue, $api->addRepository('KnpWorld', 'l3l0', 'l3l0Repo'));
@@ -177,7 +177,7 @@ public function shouldRemoveTeamRepository()
177177
$api = $this->getApiMock();
178178
$api->expects($this->once())
179179
->method('delete')
180-
->with('/teams/KnpWorld/repos/l3l0/l3l0Repo')
180+
->with('/orgs/l3l0/teams/KnpWorld/repos/l3l0/l3l0Repo')
181181
->will($this->returnValue($expectedValue));
182182

183183
$this->assertEquals($expectedValue, $api->removeRepository('KnpWorld', 'l3l0', 'l3l0Repo'));

0 commit comments

Comments
 (0)