diff --git a/lib/Github/Api/PullRequest.php b/lib/Github/Api/PullRequest.php old mode 100644 new mode 100755 index e52815cf01a..5151f1cd105 --- a/lib/Github/Api/PullRequest.php +++ b/lib/Github/Api/PullRequest.php @@ -19,20 +19,16 @@ class PullRequest extends AbstractApi * * @param string $username the username * @param string $repository the repository - * @param string $state the state of the fetched pull requests. - * The API seems to automatically default to 'open' - * @param integer $page the page - * @param integer $perPage the per page + * @param array $params a list of extra parameters. * * @return array array of pull requests for the project */ - public function all($username, $repository, $state = null, $page = 1, $perPage = 30) + public function all($username, $repository, array $params = array()) { - $parameters = array( - 'page' => $page, - 'per_page' => $perPage, - 'state' => $state, - ); + $parameters = array_merge(array( + 'page' => 1, + 'per_page' => 30 + ), $params); return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $parameters); } diff --git a/test/Github/Tests/Api/PullRequestTest.php b/test/Github/Tests/Api/PullRequestTest.php old mode 100644 new mode 100755 index ac38dc4513d..0a0aa067ce4 --- a/test/Github/Tests/Api/PullRequestTest.php +++ b/test/Github/Tests/Api/PullRequestTest.php @@ -33,7 +33,7 @@ public function shouldGetOpenPullRequests() ->with('repos/ezsystems/ezpublish/pulls', array('state' => 'open', 'per_page' => 30, 'page' => 1)) ->will($this->returnValue($expectedArray)); - $this->assertEquals($expectedArray, $api->all('ezsystems', 'ezpublish', 'open')); + $this->assertEquals($expectedArray, $api->all('ezsystems', 'ezpublish', array('state' => 'open'))); } /** @@ -49,7 +49,7 @@ public function shouldGetClosedPullRequests() ->with('repos/ezsystems/ezpublish/pulls', array('state' => 'closed', 'per_page' => 30, 'page' => 1)) ->will($this->returnValue($expectedArray)); - $this->assertEquals($expectedArray, $api->all('ezsystems', 'ezpublish', 'closed')); + $this->assertEquals($expectedArray, $api->all('ezsystems', 'ezpublish', array('state' => 'closed'))); } /**