Skip to content

Commit c73d21b

Browse files
committed
implemented Commits::deleteApproval (API 2.0)
1 parent 70b1a53 commit c73d21b

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

docs/repositories/commits.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ $commits->get($account_name, $repo_slug, $commitSHA1);
3131
$commits->approve($account_name, $repo_slug, $commitSHA1);
3232
```
3333

34+
### Delete a commit approval: (API 2.0)
35+
```php
36+
$commits->deleteApproval($account_name, $repo_slug, $commitSHA1);
37+
```
38+
3439
----
3540

3641
#### Related:

lib/Bitbucket/API/Repositories/Commits.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,22 @@ public function approve($account, $repo, $revision)
7474
sprintf('repositories/%s/%s/commit/%s/approve', $account, $repo, $revision)
7575
);
7676
}
77+
78+
/**
79+
* Delete a commit approval
80+
*
81+
* NOTE: On success returns `HTTP/1.1 204 NO CONTENT`
82+
*
83+
* @access public
84+
* @param string $account The team or individual account owning the repository.
85+
* @param string $repo The repository identifier.
86+
* @param string $revision A SHA1 value for the commit.
87+
* @return MessageInterface
88+
*/
89+
public function deleteApproval($account, $repo, $revision)
90+
{
91+
return $this->getClient()->setApiVersion('2.0')->delete(
92+
sprintf('repositories/%s/%s/commit/%s/approve', $account, $repo, $revision)
93+
);
94+
}
7795
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,19 @@ public function testApproveACommit()
7575

7676
$commit->approve('gentle', 'eof', 'SHA1');
7777
}
78+
79+
public function testDeleteCommitApproval()
80+
{
81+
$endpoint = 'repositories/gentle/eof/commit/SHA1/approve';
82+
83+
$client = $this->getHttpClientMock();
84+
$client->expects($this->once())
85+
->method('delete')
86+
->with($endpoint);
87+
88+
/** @var \Bitbucket\API\Repositories\Commits $commit */
89+
$commit = $this->getClassMock('Bitbucket\API\Repositories\Commits', $client);
90+
91+
$commit->deleteApproval('gentle', 'eof', 'SHA1');
92+
}
7893
}

0 commit comments

Comments
 (0)