Skip to content

Commit c61e360

Browse files
committed
Merge branch '2.x'
* 2.x: Update branch alias feature KnpLabs#938 Add parameters to PullRequest commits method (seanmtaylor)
2 parents 4e588d5 + 562ca30 commit c61e360

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
},
4848
"extra": {
4949
"branch-alias": {
50-
"dev-2.x": "2.17.x-dev",
50+
"dev-2.x": "2.18.x-dev",
5151
"dev-master": "3.0.x-dev"
5252
}
5353
}

lib/Github/Api/PullRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ public function show($username, $repository, $id)
8080
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$id);
8181
}
8282

83-
public function commits($username, $repository, $id)
83+
public function commits($username, $repository, $id, array $parameters = [])
8484
{
85-
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/commits');
85+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/commits', $parameters);
8686
}
8787

8888
public function files($username, $repository, $id, array $parameters = [])

test/Github/Tests/Api/PullRequestTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ public function shouldShowCommitsFromPullRequest()
8787
$this->assertEquals($expectedArray, $api->commits('ezsystems', 'ezpublish', '15'));
8888
}
8989

90+
/**
91+
* @test
92+
*/
93+
public function shouldShowCommitsFromPullRequestForPage()
94+
{
95+
$expectedArray = [['id' => 'id', 'sha' => '123123']];
96+
97+
$api = $this->getApiMock();
98+
$api->expects($this->once())
99+
->method('get')
100+
->with('/repos/ezsystems/ezpublish/pulls/15/commits', ['page' => 2, 'per_page' => 30])
101+
->willReturn($expectedArray);
102+
103+
$this->assertEquals($expectedArray, $api->commits('ezsystems', 'ezpublish', '15', ['page' => 2, 'per_page' => 30]));
104+
}
105+
90106
/**
91107
* @test
92108
*/

0 commit comments

Comments
 (0)