Skip to content

Commit

Permalink
Merge pull request UnionOfRAD#413 from jails/dev-pr2
Browse files Browse the repository at this point in the history
Infinite loop on LF\Test\Unit::_compare() solved
  • Loading branch information
nateabele committed Apr 2, 2012
2 parents 36a24a3 + b4a2a5f commit 31e07d4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
5 changes: 2 additions & 3 deletions test/Unit.php
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,7 @@ protected function _compare($type, $expected, $result = null, $trace = null) {
if (!empty($data)) {
return $data;
}
}
if (!is_scalar($result)) {
} elseif (!is_scalar($result)) {
$data = $this->_compare($type, $result, $expected);

if (!empty($data)) {
Expand Down Expand Up @@ -1055,4 +1054,4 @@ protected function _hasNetwork($config = array()) {
}
}

?>
?>
26 changes: 24 additions & 2 deletions tests/cases/test/UnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,28 @@ public function testCompareIdenticalArray() {
$this->assertEqual($expected, $result);
}

public function testCompareIdenticalMixedArray() {
$array1 = array(
'command' => 'test',
'action' => 'action',
'args' => array(),
'long' => 'something',
'i' => 1
);

$array2 = array(
'command' => 'test',
'action' => 'action',
'long' => 'something',
'args' => array(),
'i' => 1
);

$result = $this->compare('identical', $array1, $array2);
$expected = array('trace' => null, 'expected' => $array1, 'result' => $array2);
$this->assertEqual($expected, $result);
}

public function imethods() {
return array('testCompareIdenticalArray');
}
Expand All @@ -643,7 +665,7 @@ public function testCompareIdenticalNullArray() {
*
*/
public function testResults() {
$expected = 107;
$expected = 108;
$result = count($this->results());
$this->assertEqual($expected, $result);
}
Expand Down Expand Up @@ -671,7 +693,7 @@ public function testTestMethods() {
'testGetTest', 'testAssertCookie', 'testAssertCookieWithHeaders',
'testCompareWithEmptyResult',
'testExceptionCatching', 'testErrorHandling', 'testAssertObjects',
'testAssertArrayIdentical', 'testCompareIdenticalArray',
'testAssertArrayIdentical', 'testCompareIdenticalArray','testCompareIdenticalMixedArray',
'testCompareEqualNullArray', 'testCompareIdenticalNullArray',
'testResults', 'testTestMethods'
);
Expand Down

0 comments on commit 31e07d4

Please sign in to comment.