Skip to content

Commit b43e838

Browse files
committed
updated PullRequests::Comments::all to API 2.0
1 parent 50f70f0 commit b43e838

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Bitbucket\API\Repositories\PullRequests;
1313

1414
use Bitbucket\API;
15+
use Buzz\Message\MessageInterface;
1516

1617
/**
1718
* Comments class
@@ -28,13 +29,13 @@ class Comments extends API\Api
2829
* @access public
2930
* @param string $account The team or individual account owning the repository.
3031
* @param string $repo The repository identifier.
31-
* @param int $requestID An integer representing an id for the request.
32-
* @return mixed
32+
* @param int $id ID of the pull request
33+
* @return MessageInterface
3334
*/
34-
public function all($account, $repo, $requestID)
35+
public function all($account, $repo, $id)
3536
{
36-
return $this->requestGet(
37-
sprintf('repositories/%s/%s/pullrequests/%d/comments', $account, $repo, $requestID)
37+
return $this->getClient()->setApiVersion('2.0')->get(
38+
sprintf('repositories/%s/%s/pullrequests/%d/comments', $account, $repo, $id)
3839
);
3940
}
4041

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ class CommentsTest extends Tests\TestCase
1010
public function testGetAllComments()
1111
{
1212
$endpoint = 'repositories/gentle/eof/pullrequests/3/comments';
13-
$expectedResult = json_encode('dummy');
13+
$expectedResult = $this->fakeResponse(array('dummy'));
1414

15-
$comments = $this->getApiMock('Bitbucket\API\Repositories\PullRequests\Comments');
16-
$comments->expects($this->once())
17-
->method('requestGet')
15+
$client = $this->getHttpClientMock();
16+
$client->expects($this->once())
17+
->method('get')
1818
->with($endpoint)
19-
->will( $this->returnValue($expectedResult) );
19+
->will($this->returnValue($expectedResult));
2020

21-
/** @var $comments \Bitbucket\API\Repositories\PullRequests\Comments */
22-
$actual = $comments->all('gentle', 'eof', 3);
21+
/** @var \Bitbucket\API\Repositories\PullRequests\Comments $comments */
22+
$comments = $this->getClassMock('Bitbucket\API\Repositories\PullRequests\Comments', $client);
23+
$actual = $comments->all('gentle', 'eof', 3);
2324

2425
$this->assertEquals($expectedResult, $actual);
2526
}
@@ -83,4 +84,4 @@ public function testDeleteCommentSuccess()
8384
/** @var $comment \Bitbucket\API\Repositories\PullRequests\Comments */
8485
$comment->delete('gentle', 'eof', 1, 2);
8586
}
86-
}
87+
}

0 commit comments

Comments
 (0)