tests: port assertEquals() with delta to assertEqualsWithDelta()
assertEquals() in phpunit 9.5 no longer takes a delta parameter and has assertEqualsWithDelta() as a replacement. This means float get compared without a delta atm, and a recent phpunit release (9.5.25) has made float comparisons stricter resulting in test suite errors such as: 1) SubtaskTimeTrackingModelTest::testCalculateSubtaskTime Total spent Failed asserting that 3.3000000000000003 matches expected 3.3. tests/units/Model/SubtaskTimeTrackingModelTest.php:186 This replaces all assertEquals() calls that pass a delta value with assertEqualsWithDelta().
This commit is contained in:
committed by
Frédéric Guillot
parent
2d4ee932da
commit
0b8a270bbb
@@ -45,7 +45,7 @@ class ProjectModelTest extends Base
|
||||
$this->assertEquals(0, $project['is_private']);
|
||||
$this->assertEquals(0, $project['per_swimlane_task_limits']);
|
||||
$this->assertEquals(0, $project['task_limit']);
|
||||
$this->assertEquals(time(), $project['last_modified'], '', 1);
|
||||
$this->assertEqualsWithDelta(time(), $project['last_modified'], 1, '');
|
||||
$this->assertEmpty($project['token']);
|
||||
$this->assertEmpty($project['start_date']);
|
||||
$this->assertEmpty($project['end_date']);
|
||||
@@ -191,7 +191,7 @@ class ProjectModelTest extends Base
|
||||
|
||||
$project = $projectModel->getById(1);
|
||||
$this->assertNotEmpty($project);
|
||||
$this->assertEquals($now, $project['last_modified'], 'Wrong Timestamp', 1);
|
||||
$this->assertEqualsWithDelta($now, $project['last_modified'], 1, 'Wrong Timestamp');
|
||||
|
||||
sleep(1);
|
||||
$this->assertTrue($projectModel->updateModificationDate(1));
|
||||
|
||||
Reference in New Issue
Block a user