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
@@ -25,8 +25,8 @@ class CommentModelTest extends Base
|
||||
$this->assertEquals(1, $comment['task_id']);
|
||||
$this->assertEquals(1, $comment['user_id']);
|
||||
$this->assertEquals('admin', $comment['username']);
|
||||
$this->assertEquals(time(), $comment['date_creation'], '', 3);
|
||||
$this->assertEquals(time(), $comment['date_modification'], '', 3);
|
||||
$this->assertEqualsWithDelta(time(), $comment['date_creation'], 3, '');
|
||||
$this->assertEqualsWithDelta(time(), $comment['date_modification'], 3, '');
|
||||
|
||||
$comment = $commentModel->getById(2);
|
||||
$this->assertNotEmpty($comment);
|
||||
@@ -34,8 +34,8 @@ class CommentModelTest extends Base
|
||||
$this->assertEquals(1, $comment['task_id']);
|
||||
$this->assertEquals(0, $comment['user_id']);
|
||||
$this->assertEquals('', $comment['username']);
|
||||
$this->assertEquals(time(), $comment['date_creation'], '', 3);
|
||||
$this->assertEquals(time(), $comment['date_modification'], '', 3);
|
||||
$this->assertEqualsWithDelta(time(), $comment['date_creation'], 3, '');
|
||||
$this->assertEqualsWithDelta(time(), $comment['date_modification'], 3, '');
|
||||
}
|
||||
|
||||
public function testGetAll()
|
||||
@@ -75,7 +75,7 @@ class CommentModelTest extends Base
|
||||
$comment = $commentModel->getById(1);
|
||||
$this->assertNotEmpty($comment);
|
||||
$this->assertEquals('bla', $comment['comment']);
|
||||
$this->assertEquals(time(), $comment['date_modification'], '', 3);
|
||||
$this->assertEqualsWithDelta(time(), $comment['date_modification'], 3, '');
|
||||
}
|
||||
|
||||
public function testRemove()
|
||||
|
||||
Reference in New Issue
Block a user