Skip to content

Commit fad45b0

Browse files
committed
Do not set the default values for requests
1 parent 8e30606 commit fad45b0

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

lib/Github/Api/PullRequest.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,12 @@ public function configure($bodyType = null, $apiVersion = null)
5555
*
5656
* @param string $username the username
5757
* @param string $repository the repository
58-
* @param array $params a list of extra parameters.
58+
* @param array $parameters a list of extra parameters.
5959
*
6060
* @return array array of pull requests for the project
6161
*/
62-
public function all($username, $repository, array $params = [])
62+
public function all($username, $repository, array $parameters = [])
6363
{
64-
$parameters = array_merge([
65-
'page' => 1,
66-
'per_page' => 30,
67-
], $params);
68-
6964
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $parameters);
7065
}
7166

@@ -90,13 +85,8 @@ public function commits($username, $repository, $id)
9085
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/commits');
9186
}
9287

93-
public function files($username, $repository, $id, array $params = [])
88+
public function files($username, $repository, $id, array $parameters = [])
9489
{
95-
$parameters = array_merge([
96-
'page' => 1,
97-
'per_page' => 30,
98-
], $params);
99-
10090
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/files', $parameters);
10191
}
10292

test/Github/Tests/Api/PullRequestTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function shouldGetOpenPullRequests()
3232
$api = $this->getApiMock();
3333
$api->expects($this->once())
3434
->method('get')
35-
->with('/repos/ezsystems/ezpublish/pulls', ['state' => 'open', 'per_page' => 30, 'page' => 1])
35+
->with('/repos/ezsystems/ezpublish/pulls', ['state' => 'open'])
3636
->will($this->returnValue($expectedArray));
3737

3838
$this->assertEquals($expectedArray, $api->all('ezsystems', 'ezpublish', ['state' => 'open']));
@@ -48,7 +48,7 @@ public function shouldGetClosedPullRequests()
4848
$api = $this->getApiMock();
4949
$api->expects($this->once())
5050
->method('get')
51-
->with('/repos/ezsystems/ezpublish/pulls', ['state' => 'closed', 'per_page' => 30, 'page' => 1])
51+
->with('/repos/ezsystems/ezpublish/pulls', ['state' => 'closed'])
5252
->will($this->returnValue($expectedArray));
5353

5454
$this->assertEquals($expectedArray, $api->all('ezsystems', 'ezpublish', ['state' => 'closed']));
@@ -97,7 +97,7 @@ public function shouldShowFilesFromPullRequest()
9797
$api = $this->getApiMock();
9898
$api->expects($this->once())
9999
->method('get')
100-
->with('/repos/ezsystems/ezpublish/pulls/15/files', ['page' => 1, 'per_page' => 30])
100+
->with('/repos/ezsystems/ezpublish/pulls/15/files')
101101
->will($this->returnValue($expectedArray));
102102

103103
$this->assertEquals($expectedArray, $api->files('ezsystems', 'ezpublish', '15'));

0 commit comments

Comments
 (0)