sebastianbergmann/phpunit — pull request #394 by asm89 (2011-11-03 08:04:29+00:00)
Title: Added Numeric comparator (to retain BC?)

In the new 3.6.0 release, the behavior of assertEquals with a delta parameter seems to have changed. I believe there are two things that changed:

1) The new release only allows for floats/doubles to be compared with a delta, whereas the previous stable release 3.5.15 allowed all numeric values to be compared with a delta.
The 'old' version actually had a numericComparison for it, instead of the new Double comparator:
https://github.com/sebastianbergmann/phpunit/blob/3.5.15/PHPUnit/Framework/Constraint/IsEqual.php#L292
https://github.com/sebastianbergmann/phpunit/blob/3.5.15/PHPUnit/Framework/Constraint/IsEqual.php#L363

2) The delta parameter seems to be handled in a slightly different way:
The older version would return success if ```abs($expected - $actual) <= $delta```
https://github.com/sebastianbergmann/phpunit/blob/3.5.15/PHPUnit/Framework/Constraint/IsEqual.php#L368

The newer version will return success if ```abs($expected - $actual) < $delta``` (it fails if ```abs($expected - $actual) >= $delta```):
https://github.com/sebastianbergmann/phpunit/blob/master/PHPUnit/Framework/Comparator/Double.php#L110

--------------------------------------

I'm not sure if this is an intentional BC break? There is nothing mentioned about it in the changelog. I've "found" the BC break with testsuites that suddenly had failing tests...

If it was not intentional please review the patch that I've attached.