diff --git a/tests/system/EntityTest.php b/tests/system/EntityTest.php index af09d11f0716..45d5cd7381c6 100644 --- a/tests/system/EntityTest.php +++ b/tests/system/EntityTest.php @@ -174,7 +174,7 @@ public function testDateMutationFromTimestamp() $time = $entity->created_at; $this->assertInstanceOf(Time::class, $time); - $this->assertEquals(date('Y-m-d H:i:s', $stamp), $time->format('Y-m-d H:i:s')); + $this->assertCloseEnoughString(date('Y-m-d H:i:s', $stamp), $time->format('Y-m-d H:i:s')); } public function testDateMutationFromDatetime() @@ -186,7 +186,7 @@ public function testDateMutationFromDatetime() $time = $entity->created_at; $this->assertInstanceOf(Time::class, $time); - $this->assertEquals($dt->format('Y-m-d H:i:s'), $time->format('Y-m-d H:i:s')); + $this->assertCloseEnoughString($dt->format('Y-m-d H:i:s'), $time->format('Y-m-d H:i:s')); } public function testDateMutationFromTime() @@ -198,7 +198,7 @@ public function testDateMutationFromTime() $time = $entity->created_at; $this->assertInstanceOf(Time::class, $time); - $this->assertEquals($dt->format('Y-m-d H:i:s'), $time->format('Y-m-d H:i:s')); + $this->assertCloseEnoughString($dt->format('Y-m-d H:i:s'), $time->format('Y-m-d H:i:s')); } public function testDateMutationStringToTime() @@ -223,7 +223,7 @@ public function testDateMutationTimestampToTime() $time = $this->getPrivateProperty($entity, 'created_at'); $this->assertInstanceOf(Time::class, $time); - $this->assertEquals(date('Y-m-d H:i:s'), $time->format('Y-m-d H:i:s')); + $this->assertCloseEnoughString(date('Y-m-d H:i:s'), $time->format('Y-m-d H:i:s')); } public function testDateMutationDatetimeToTime() @@ -236,7 +236,7 @@ public function testDateMutationDatetimeToTime() $time = $this->getPrivateProperty($entity, 'created_at'); $this->assertInstanceOf(Time::class, $time); - $this->assertEquals($dt->format('Y-m-d H:i:s'), $time->format('Y-m-d H:i:s')); + $this->assertCloseEnoughString($dt->format('Y-m-d H:i:s'), $time->format('Y-m-d H:i:s')); } public function testDateMutationTimeToTime() @@ -249,7 +249,7 @@ public function testDateMutationTimeToTime() $time = $this->getPrivateProperty($entity, 'created_at'); $this->assertInstanceOf(Time::class, $time); - $this->assertEquals($dt->format('Y-m-d H:i:s'), $time->format('Y-m-d H:i:s')); + $this->assertCloseEnoughString($dt->format('Y-m-d H:i:s'), $time->format('Y-m-d H:i:s')); } //-------------------------------------------------------------------- diff --git a/tests/system/I18n/TimeTest.php b/tests/system/I18n/TimeTest.php index 0db95986dfe6..0a876c4a81cf 100644 --- a/tests/system/I18n/TimeTest.php +++ b/tests/system/I18n/TimeTest.php @@ -167,7 +167,7 @@ public function testCreateFromTimeLocalized() { $time = Time::createFromTime(10, 03, 05, 'Europe/London'); - $this->assertEquals(date('Y-m-d 10:03:05'), $time->toDateTimeString()); + $this->assertCloseEnoughString(date('Y-m-d 10:03:05'), $time->toDateTimeString()); } public function testCreateFromFormat() @@ -177,7 +177,7 @@ public function testCreateFromFormat() Time::setTestNow($now); $time = Time::createFromFormat('F j, Y', 'January 15, 2017', 'America/Chicago'); - $this->assertEquals(date('2017-01-15 H:i:s', $now->getTimestamp()), $time->toDateTimeString()); + $this->assertCloseEnoughString(date('2017-01-15 H:i:s', $now->getTimestamp()), $time->toDateTimeString()); Time::setTestNow(); }