Skip to content

Commit bbcd02d

Browse files
committed
implemented PullRequests::activity (API 2.0)
1 parent 350a08f commit bbcd02d

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

docs/repositories/pullrequests.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ $pull->delete($account_name, $repo_slug, 1);
7777
$pull->diff($account_name, $repo_slug, 1);
7878
```
7979

80+
### Get the log of all of a repository's pull request activity
81+
```php
82+
$pull->activity($account_name, $repo_slug, 1);
83+
```
84+
8085
----
8186

8287
#### Related:

lib/Bitbucket/API/Repositories/PullRequests.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,20 @@ public function diff($account, $repo, $id)
211211
sprintf('repositories/%s/%s/pullrequests/%d/diff', $account, $repo, $id)
212212
);
213213
}
214+
215+
/**
216+
* Get the log of all of a repository's pull request activity
217+
*
218+
* @access public
219+
* @param string $account The team or individual account owning the repository.
220+
* @param string $repo The repository identifier.
221+
* @param int $id ID of the pull request
222+
* @return MessageInterface
223+
*/
224+
public function activity($account, $repo, $id)
225+
{
226+
return $this->getClient()->setApiVersion('2.0')->get(
227+
sprintf('repositories/%s/%s/pullrequests/%d/activity', $account, $repo, $id)
228+
);
229+
}
214230
}

test/Bitbucket/Tests/API/Repositories/PullRequestsTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,22 @@ public function testGetPullRequestDiff()
218218

219219
$this->assertEquals($expectedResult, $actual);
220220
}
221+
222+
public function testGetPullRequestActivity()
223+
{
224+
$endpoint = 'repositories/gentle/eof/pullrequests/1/activity';
225+
$expectedResult = $this->fakeResponse(array('dummy'));
226+
227+
$client = $this->getHttpClientMock();
228+
$client->expects($this->once())
229+
->method('get')
230+
->with($endpoint)
231+
->will($this->returnValue($expectedResult));
232+
233+
/** @var \Bitbucket\API\Repositories\PullRequests $pull */
234+
$pull = $this->getClassMock('Bitbucket\API\Repositories\PullRequests', $client);
235+
$actual = $pull->activity('gentle', 'eof', 1);
236+
237+
$this->assertEquals($expectedResult, $actual);
238+
}
221239
}

0 commit comments

Comments
 (0)