Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions App/Lib/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Test
'PASSED', // Functional & Acceptance Test
'OK \(' // Unit Test
),
'failed' => 'FAILURES',
'failed' => 'FAIL',
);

/**
Expand Down Expand Up @@ -275,14 +275,25 @@ public function getState()
*/
public function setLog($lines = array())
{
$has_fail = false;
$has_pass = false;
foreach ($lines as $line) {

if ($this->checkLogForTestPass($line))
$this->setPassed();
if ($this->checkLogForTestPass($line)) {
$has_pass = true;
}

if($this->checkLogForTestFail($line)) {
$has_fail = true;
}

// Filter the line of any junk and add to the log.
$this->log[] = $this->filterLog($line);
}

if( $has_pass && !$has_fail ) {
$this->setPassed();
}
}

/**
Expand Down Expand Up @@ -317,6 +328,18 @@ public function checkLogForTestPass($line)
return count(preg_grep("/({$this->passed_regex})/", array($line))) > 0;
}

/**
* Check if it contains any text that indiciates that the test has failed.
*
* @param string $line
* @return boolean
*/
public function checkLogForTestFail($line)
{
if(preg_match('/'.$this->responses['failed'].'/', $line)) return true;
return false;
}

/**
* Reset a Test back to default.
*/
Expand Down