Skip to content

Commit 6299ce8

Browse files
committed
Add failing test
1 parent d4d4fce commit 6299ce8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/Unit/Models/Attributes/TimestampTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,17 @@ public function test_windows_int_type_properly_handles_minimum()
146146
$this->assertSame($min, $timestamp->toDateTime($min));
147147
$this->assertSame($min, $timestamp->toDateTime((string) $min));
148148
}
149+
150+
public function test_windows_int_type_rounds_correctly()
151+
{
152+
$timestamp = new Timestamp('windows-int');
153+
154+
foreach (['133692539995000000', '133692539999500000'] as $windowsIntegerTime) {
155+
$dateTime = $timestamp->toDateTime($windowsIntegerTime);
156+
157+
$expectedUnixTimestamp = (int) ($windowsIntegerTime / 10000000) - 11644473600;
158+
159+
$this->assertEquals($expectedUnixTimestamp, $dateTime->getTimestamp());
160+
}
161+
}
149162
}

0 commit comments

Comments
 (0)