Skip to content

Commit f42b1a0

Browse files
committed
test: fix test code for Time::createFromTimestamp()
The microseconds should be preserved without rounding.
1 parent 97148ef commit f42b1a0

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎tests/system/I18n/TimeTest.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,14 @@ public function testCreateFromTimestamp(): void
287287
date_default_timezone_set($tz);
288288
}
289289

290-
public function testCreateFromTimestampWithMicrotime(): void
290+
public function testCreateFromTimestampWithMicroseconds(): void
291291
{
292292
$timestamp = 1489762800.654321;
293293

294294
// The timezone will be UTC if you don't specify.
295295
$time = Time::createFromTimestamp($timestamp);
296296

297-
// float cannot handle the number precisely.
298-
$this->assertSame('2017-03-17 15:00:00.654300', $time->format('Y-m-d H:i:s.u'));
297+
$this->assertSame('2017-03-17 15:00:00.654321', $time->format('Y-m-d H:i:s.u'));
299298
}
300299

301300
public function testCreateFromTimestampWithTimezone(): void

0 commit comments

Comments
 (0)