We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3b3010c commit 9d7b9eeCopy full SHA for 9d7b9ee
1 file changed
tests/Gedmo/Timestampable/TimestampableDocumentTest.php
@@ -16,6 +16,7 @@
16
use Gedmo\Tests\Timestampable\Fixture\Document\Type;
17
use Gedmo\Tests\Tool\BaseTestCaseMongoODM;
18
use Gedmo\Timestampable\TimestampableListener;
19
+use MongoDB\BSON\Timestamp;
20
21
/**
22
* These are tests for Timestampable behavior ODM implementation
@@ -41,7 +42,11 @@ public function testTimestampable(): void
41
42
43
$date = new \DateTime();
44
$now = time();
- $created = $article->getCreated()->getTimestamp();
45
+ $created = $article->getCreated();
46
+ if ($created instanceof Timestamp) {
47
+ $created = $created->getTimestamp();
48
+ }
49
+
50
static::assertTrue($created > $now - 5 && $created < $now + 5); // 5 seconds interval if lag
51
static::assertSame(
52
$date->format('Y-m-d H:i'),
0 commit comments