Skip to content

Commit d404193

Browse files
authored
Merge pull request #845 from deetergp/scott_addTeamPrAbilty
Allow create & remove to set and remove requests for teams
2 parents ffddf1d + 0a19add commit d404193

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lib/Github/Api/PullRequest/ReviewRequest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ public function all($username, $repository, $pullRequest, array $params = [])
3939
* @param string $repository
4040
* @param int $pullRequest
4141
* @param array $reviewers
42+
* @param array $teamReviewers
4243
*
4344
* @return string
4445
*/
45-
public function create($username, $repository, $pullRequest, array $reviewers)
46+
public function create($username, $repository, $pullRequest, array $reviewers = [], array $teamReviewers = [])
4647
{
47-
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers]);
48+
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers, 'team_reviewers' => $teamReviewers]);
4849
}
4950

5051
/**
@@ -54,11 +55,12 @@ public function create($username, $repository, $pullRequest, array $reviewers)
5455
* @param string $repository
5556
* @param int $pullRequest
5657
* @param array $reviewers
58+
* @param array $teamReviewers
5759
*
5860
* @return string
5961
*/
60-
public function remove($username, $repository, $pullRequest, array $reviewers)
62+
public function remove($username, $repository, $pullRequest, array $reviewers = [], array $teamReviewers = [])
6163
{
62-
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers]);
64+
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers, 'team_reviewers' => $teamReviewers]);
6365
}
6466
}

test/Github/Tests/Api/PullRequest/ReviewRequestTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public function shouldCreateReviewRequest()
3535
$api = $this->getApiMock();
3636
$api->expects($this->once())
3737
->method('post')
38-
->with('/repos/octocat/Hello-World/pulls/12/requested_reviewers', ['reviewers' => ['testuser']])
38+
->with('/repos/octocat/Hello-World/pulls/12/requested_reviewers', ['reviewers' => ['testuser'], 'team_reviewers' => ['testteam']])
3939
;
4040

41-
$api->create('octocat', 'Hello-World', 12, ['testuser']);
41+
$api->create('octocat', 'Hello-World', 12, ['testuser'], ['testteam']);
4242
}
4343

4444
/**
@@ -49,10 +49,10 @@ public function shouldDeleteReviewRequest()
4949
$api = $this->getApiMock();
5050
$api->expects($this->once())
5151
->method('delete')
52-
->with('/repos/octocat/Hello-World/pulls/12/requested_reviewers', ['reviewers' => ['testuser']])
52+
->with('/repos/octocat/Hello-World/pulls/12/requested_reviewers', ['reviewers' => ['testuser'], 'team_reviewers' => ['testteam']])
5353
;
5454

55-
$api->remove('octocat', 'Hello-World', 12, ['testuser']);
55+
$api->remove('octocat', 'Hello-World', 12, ['testuser'], ['testteam']);
5656
}
5757

5858
/**

0 commit comments

Comments
 (0)