Skip to content

Commit

Permalink
fix multiple statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
christofdamian committed Jan 5, 2016
1 parent fb10294 commit 9a9629e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGES
=======

0.5.9
-----
* fix bug with multiple statuses

0.5.8
-----
* allow leading whitespace
Expand Down
8 changes: 7 additions & 1 deletion src/PlusPull/GitHub/PullRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,16 @@ public function getCommentValue($commentBody)

public function checkStatuses()
{
if (empty($this->statuses[0]['state'])) {
if (empty($this->statuses)) {
return false;
}

foreach ($this->statuses as $status) {
if (empty($status['state']) or $status['state']!='success') {
return false;
}
}

return $this->statuses[0]['state']=='success';
}

Expand Down
14 changes: 14 additions & 0 deletions tests/PlusPull/GitHub/PullRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,20 @@ public function checkStatusesProvider()
'statuses' => array(array('state' => 'error')),
'expected' => false,
),
'both, first error' => array(
'statuses' => array(
array('state' => 'error'),
array('state' => 'success'),
),
'expected' => false,
),
'both, first success' => array(
'statuses' => array(
array('state' => 'success'),
array('state' => 'error'),
),
'expected' => false,
),
);
}

Expand Down

0 comments on commit 9a9629e

Please sign in to comment.