Skip to content
Browse files

- Correctly handle NULL values.

  • Loading branch information...
1 parent 4d743bd commit 1390c2251f302cb0c16974201c5382979e2b847f @sebastianbergmann committed May 6, 2007
Showing with 2 additions and 7 deletions.
  1. +2 −7 PHPUnit/Framework/ComparisonFailure.php
View
9 PHPUnit/Framework/ComparisonFailure.php
@@ -129,7 +129,7 @@ public static function diffIdentical($expected, $actual, $message = '')
return new PHPUnit_Framework_ComparisonFailure_String($expected, $actual, $message);
}
- elseif (is_bool($expected) || is_int($expected) || is_float($expected)) {
+ elseif (is_null($expected) || is_scalar($expected)) {
return new PHPUnit_Framework_ComparisonFailure_Scalar($expected, $actual, $message);
}
@@ -156,16 +156,11 @@ public static function diffIdentical($expected, $actual, $message = '')
*/
public static function diffEqual($expected, $actual, $message = '')
{
- if (gettype($expected) !== gettype($actual)) {
- $expected = (string)$expected;
- $actual = (string)$actual;
- }
-
if (is_string($expected)) {
return new PHPUnit_Framework_ComparisonFailure_String($expected, $actual, $message);
}
- elseif (is_bool($expected) || is_int($expected) || is_float($expected)) {
+ elseif (is_null($expected) || is_scalar($expected)) {
return new PHPUnit_Framework_ComparisonFailure_Scalar($expected, $actual, $message);
}

0 comments on commit 1390c22

Please sign in to comment.
Something went wrong with that request. Please try again.