Skip to content

Commit 965e9de

Browse files
committed
implemented another datetimeimmutable test
1 parent e7fe658 commit 965e9de

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
/CONTRIBUTING.md export-ignore
55
/phpcs.xml.dist export-ignore
66
/phpstan.neon export-ignore
7-
/benchmark export-ignore
7+
/performance export-ignore
88
/generator export-ignore

generator/tests/DateTimeImmutableTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,15 @@ public function testSerialize()
142142
$this->assertEquals($safeDatetime->getTimestamp(), $newDatetime->getTimestamp());
143143
$this->assertEquals($safeDatetime->getTimezone(), $newDatetime->getTimezone());
144144
}
145+
146+
public function testComparaison(): void
147+
{
148+
$safeDateTime = new \Safe\DateTimeImmutable();
149+
$phpDateTime = new \DateTimeImmutable();
150+
$timeLimit = \DateInterval::createFromDateString('2 hours');
151+
152+
$a = $safeDateTime->modify('+3 hours') < $safeDateTime->add($timeLimit);
153+
$b = $phpDateTime->modify('+3 hours') < $phpDateTime->add($timeLimit);
154+
$this->assertEquals($b, $a);
155+
}
145156
}

0 commit comments

Comments
 (0)