Skip to content

Commit 4b8a05a

Browse files
committed
Added support for deleting a label
1 parent bad6991 commit 4b8a05a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

lib/Github/Api/Issue/Labels.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public function create($username, $repository, array $params)
3333
return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels', $params);
3434
}
3535

36+
public function deleteLabel($username, $repository, $label)
37+
{
38+
return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label));
39+
}
40+
3641
public function add($username, $repository, $issue, $labels)
3742
{
3843
if (is_string($labels)) {

test/Github/Tests/Api/Issue/LabelsTest.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class LabelsTest extends TestCase
88
{
9-
109
/**
1110
* @test
1211
*/
@@ -76,6 +75,22 @@ public function shouldCreateLabelWithColor()
7675
$this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data));
7776
}
7877

78+
/**
79+
* @test
80+
*/
81+
public function shouldDeleteLabel()
82+
{
83+
$expectedValue = array('someOutput');
84+
85+
$api = $this->getApiMock();
86+
$api->expects($this->once())
87+
->method('delete')
88+
->with('repos/KnpLabs/php-github-api/labels/foo')
89+
->will($this->returnValue($expectedValue));
90+
91+
$this->assertEquals($expectedValue, $api->deleteLabel('KnpLabs', 'php-github-api', 'foo'));
92+
}
93+
7994
/**
8095
* @test
8196
*/

0 commit comments

Comments
 (0)