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

Fixed tests on PHP 7.2+ #167

Merged
merged 1 commit into from
Jan 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions test/Header/DateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ public function testDateFromTimeStringCreatesValidDateHeader()
$date = new DateTime(null, new DateTimeZone('GMT'));
$interval = $dateHeader->date()->diff($date, 1);

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

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

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

public function testDateFromTimeStringDetectsBadInput()
Expand Down