Skip to content

Commit 5e248ab

Browse files
committed
updated PullRequests::Comments::get to API 2.0
1 parent b43e838 commit 5e248ab

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

lib/Bitbucket/API/Repositories/PullRequests/Comments.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class Comments extends API\Api
2727
* Get a list of a pull request comments
2828
*
2929
* @access public
30-
* @param string $account The team or individual account owning the repository.
31-
* @param string $repo The repository identifier.
32-
* @param int $id ID of the pull request
30+
* @param string $account The team or individual account owning the repository.
31+
* @param string $repo The repository identifier.
32+
* @param int $id ID of the pull request
3333
* @return MessageInterface
3434
*/
3535
public function all($account, $repo, $id)
@@ -43,15 +43,15 @@ public function all($account, $repo, $id)
4343
* Get an individual pull request comment
4444
*
4545
* @access public
46-
* @param string $account The team or individual account owning the repository.
47-
* @param string $repo The repository identifier.
48-
* @param int $requestID An integer representing an id for the request.
49-
* @param int $commentID The comment identifier.
50-
* @return mixed
46+
* @param string $account The team or individual account owning the repository.
47+
* @param string $repo The repository identifier.
48+
* @param int $requestID An integer representing an id for the request.
49+
* @param int $commentID The comment identifier.
50+
* @return MessageInterface
5151
*/
5252
public function get($account, $repo, $requestID, $commentID)
5353
{
54-
return $this->requestGet(
54+
return $this->getClient()->setApiVersion('2.0')->get(
5555
sprintf('repositories/%s/%s/pullrequests/%d/comments/%d', $account, $repo, $requestID, $commentID)
5656
);
5757
}

test/Bitbucket/Tests/API/Repositories/PullRequests/CommentsTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ public function testGetAllComments()
2828
public function testGetSingleComment()
2929
{
3030
$endpoint = 'repositories/gentle/eof/pullrequests/3/comments/1';
31-
$expectedResult = json_encode('dummy');
31+
$expectedResult = $this->fakeResponse(array('dummy'));
3232

33-
$comment = $this->getApiMock('Bitbucket\API\Repositories\PullRequests\Comments');
34-
$comment->expects($this->once())
35-
->method('requestGet')
33+
$client = $this->getHttpClientMock();
34+
$client->expects($this->once())
35+
->method('get')
3636
->with($endpoint)
37-
->will( $this->returnValue($expectedResult) );
37+
->will($this->returnValue($expectedResult));
3838

39-
/** @var $comment \Bitbucket\API\Repositories\PullRequests\Comments */
40-
$actual = $comment->get('gentle', 'eof', 3, 1);
39+
/** @var \Bitbucket\API\Repositories\PullRequests\Comments $comments */
40+
$comments = $this->getClassMock('Bitbucket\API\Repositories\PullRequests\Comments', $client);
41+
$actual = $comments->get('gentle', 'eof', 3, 1);
4142

4243
$this->assertEquals($expectedResult, $actual);
4344
}

0 commit comments

Comments
 (0)