Skip to content

Commit 26984df

Browse files
committed
Merge pull request #28 from WouterJ/remove_unconfirmed
Remove unconfirmed label when bug was reviewed
2 parents 42e9db4 + d300600 commit 26984df

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/AppBundle/Issues/GitHub/GitHubStatusApi.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ public function setIssueStatus($issueNumber, $newStatus)
5454
$addLabel = true;
5555

5656
foreach ($currentLabels as $label) {
57-
// Ignore non-status
58-
if (!isset($this->labelToStatus[$label])) {
57+
// Ignore non-status, except when the bug is reviewed
58+
// but still marked as unconfirmed.
59+
if (
60+
!isset($this->labelToStatus[$label])
61+
&& !(Status::REVIEWED === $newStatus && 'Unconfirmed' === $label)
62+
) {
5963
continue;
6064
}
6165

src/AppBundle/Tests/Issues/GitHub/GitHubStatusApiTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,28 @@ public function testSetIssueStatusRemovesExcessLabelsIfAlreadySet()
123123
$this->api->setIssueStatus(1234, Status::REVIEWED);
124124
}
125125

126+
public function testSetIssueStatusRemovesUnconfirmedWhenBugIsReviewed()
127+
{
128+
$this->labelsApi->expects($this->once())
129+
->method('getIssueLabels')
130+
->with(1234)
131+
->willReturn(array('Bug', 'Status: Needs Review', 'Unconfirmed'));
132+
133+
$this->labelsApi->expects($this->at(1))
134+
->method('removeIssueLabel')
135+
->with(1234, 'Status: Needs Review');
136+
137+
$this->labelsApi->expects($this->at(2))
138+
->method('removeIssueLabel')
139+
->with(1234, 'Unconfirmed');
140+
141+
$this->labelsApi->expects($this->once())
142+
->method('addIssueLabel')
143+
->with(1234, 'Status: Reviewed');
144+
145+
$this->api->setIssueStatus(1234, Status::REVIEWED);
146+
}
147+
126148
public function testGetIssueStatus()
127149
{
128150
$this->labelsApi->expects($this->once())

0 commit comments

Comments
 (0)