Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 89188e5

Browse files
committed
Merge branch 'hotfix/167' into develop
Forward port #167
2 parents 4c9bc31 + fe86f27 commit 89188e5

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

test/Header/DateTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ public function testDateFromTimeStringCreatesValidDateHeader()
3939
$date = new DateTime(null, new DateTimeZone('GMT'));
4040
$interval = $dateHeader->date()->diff($date, 1);
4141

42-
$this->assertSame('+12 hours 00 minutes 00 seconds', $interval->format('%R%H hours %I minutes %S seconds'));
42+
if (PHP_VERSION_ID >= 70200) {
43+
$this->assertSame('+11 hours 59 minutes 59 seconds', $interval->format('%R%H hours %I minutes %S seconds'));
44+
$this->assertLessThan(1, $interval->f);
45+
$this->assertGreaterThan(0, $interval->f);
46+
} else {
47+
$this->assertSame('+12 hours 00 minutes 00 seconds', $interval->format('%R%H hours %I minutes %S seconds'));
48+
}
4349
}
4450

4551
public function testDateFromTimestampCreatesValidDateHeader()
@@ -52,7 +58,13 @@ public function testDateFromTimestampCreatesValidDateHeader()
5258
$date = new DateTime(null, new DateTimeZone('GMT'));
5359
$interval = $dateHeader->date()->diff($date, 1);
5460

55-
$this->assertSame('+12 hours 00 minutes 00 seconds', $interval->format('%R%H hours %I minutes %S seconds'));
61+
if (PHP_VERSION_ID >= 70200) {
62+
$this->assertSame('+11 hours 59 minutes 59 seconds', $interval->format('%R%H hours %I minutes %S seconds'));
63+
$this->assertLessThan(1, $interval->f);
64+
$this->assertGreaterThan(0, $interval->f);
65+
} else {
66+
$this->assertSame('+12 hours 00 minutes 00 seconds', $interval->format('%R%H hours %I minutes %S seconds'));
67+
}
5668
}
5769

5870
public function testDateFromTimeStringDetectsBadInput()

0 commit comments

Comments
 (0)