MDL-75757 phpunit: Add some tolerance to a few failing assertions
Recently, PHPUnit (all versions) did some changes about how the comparators worked and this has caused some float comparisons to stop working. We need to move them to assertEqualsWithDelta(), allowing a small tolerance to workaround the floats comparison problem. 0.00001 has been decided. And applied to all the similar assertions within the unittest function, so if more cases are added to them better be copied with the agreed tolerance.
This commit is contained in:
@@ -480,6 +480,11 @@ abstract class data_loading_method_test_base extends advanced_testcase {
|
||||
|
||||
abstract class question_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Tolerance accepted in some unit tests when float operations are involved.
|
||||
*/
|
||||
const GRADE_DELTA = 0.00000005;
|
||||
|
||||
public function assert($expectation, $compare, $notused = '') {
|
||||
|
||||
if (get_class($expectation) === 'question_pattern_expectation') {
|
||||
|
||||
Reference in New Issue
Block a user