Skip to content

Commit

Permalink
Merge pull request #4 from packagist/t/pull-requests-add-diffstat
Browse files Browse the repository at this point in the history
PullRequest: add diffstat endpoint
  • Loading branch information
glaubinix authored Jul 23, 2021
2 parents 0ff4baf + 129493e commit 5fbd2dc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/Bitbucket/API/Repositories/PullRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,22 @@ public function diff($account, $repo, $id)
);
}

/**
* Get the diff stat for a pull request
*
* @access public
* @param string $account The team or individual account owning the repository.
* @param string $repo The repository identifier.
* @param int $id ID of the pull request
* @return ResponseInterface
*/
public function diffstat($account, $repo, $id)
{
return $this->getClient()->setApiVersion('2.0')->get(
sprintf('/repositories/%s/%s/pullrequests/%d/diffstat', $account, $repo, $id)
);
}

/**
* Get the log of all of a repository's pull request activity
*
Expand Down
11 changes: 11 additions & 0 deletions test/Bitbucket/Tests/API/Repositories/PullRequestsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@ public function testGetPullRequestDiff()
$this->assertResponse($expectedResult, $actual);
}

public function testGetPullRequestDiffstat()
{
$endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/diffstat';
$expectedResult = $this->fakeResponse(['dummy']);

$actual = $this->pullRequests->diffstat('gentle', 'eof', 1);

$this->assertRequest('GET', $endpoint);
$this->assertResponse($expectedResult, $actual);
}

public function testGetPullRequestActivity()
{
$endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/activity';
Expand Down

0 comments on commit 5fbd2dc

Please sign in to comment.