Skip to content

Commit 87b9c99

Browse files
authored
Ignore second in HttpRequestTest date comparison (#47719)
Microsecond was 0 because of a PHP bug: https://bugs.php.net/bug.php?id=74332 And because Carbon aligned its behavior. But it now longer make sense now that most PHP versions handle it properly so I plan to remove this hack briannesbitt/Carbon#2823 In order to keep the Laravel tests compatible, the easiest way would be ignore microsecond in the date comparison assertion.
1 parent 1ff099a commit 87b9c99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/Http/HttpRequestTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ public function testDateMethod()
723723
$this->assertNull($request->date('doesnt_exists'));
724724

725725
$this->assertEquals($current, $request->date('as_datetime'));
726-
$this->assertEquals($current, $request->date('as_format', 'U'));
726+
$this->assertEquals($current->format('Y-m-d H:i:s P'), $request->date('as_format', 'U')->format('Y-m-d H:i:s P'));
727727
$this->assertEquals($current, $request->date('as_timezone', null, 'America/Santiago'));
728728

729729
$this->assertTrue($request->date('as_date')->isSameDay($current));

0 commit comments

Comments
 (0)