File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
tests/Gedmo/Timestampable Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1616use Gedmo \Tests \Timestampable \Fixture \Document \Type ;
1717use Gedmo \Tests \Tool \BaseTestCaseMongoODM ;
1818use Gedmo \Timestampable \TimestampableListener ;
19+ use MongoDB \BSON \Timestamp ;
1920
2021/**
2122 * These are tests for Timestampable behavior ODM implementation
@@ -41,7 +42,11 @@ public function testTimestampable(): void
4142
4243 $ date = new \DateTime ();
4344 $ now = time ();
44- $ created = $ article ->getCreated ()->getTimestamp ();
45+ $ created = $ article ->getCreated ();
46+ if ($ created instanceof Timestamp) {
47+ $ created = $ created ->getTimestamp ();
48+ }
49+
4550 static ::assertTrue ($ created > $ now - 5 && $ created < $ now + 5 ); // 5 seconds interval if lag
4651 static ::assertSame (
4752 $ date ->format ('Y-m-d H:i ' ),
You can’t perform that action at this time.
0 commit comments