summaryrefslogtreecommitdiff
path: root/ext/date/tests/bug68078_negative.phpt
blob: 93b7715fe523b19505a6e4a8ee8117ff17c426ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--TEST--
Comparing datetime objects with negative timestamps should account for microseconds
--FILE--
<?php

date_default_timezone_set('UTC');
$earlyDate1 = DateTime::createFromFormat('U.u', '1.8642')->modify('-5 seconds');
$earlyDate2 = DateTime::createFromFormat('U.u', '1.2768')->modify('-5 seconds');
$earlyDate3 = DateTime::createFromFormat('U.u', '1.2768')->modify('-5 seconds');

var_dump($earlyDate1 == $earlyDate2);
var_dump($earlyDate1 < $earlyDate2);
var_dump($earlyDate2 > $earlyDate1);
var_dump($earlyDate2 == $earlyDate3);
--EXPECT--
bool(false)
bool(true)
bool(true)
bool(true)