@@ -25,10 +25,11 @@ public function itShouldCreateAUuidFromConstructor(
2525 ) {
2626 $ message = new DomainMessage ($ aggregateId , $ version , $ payload , $ date );
2727 $ this ->assertInstanceOf (DomainMessage::class, $ message );
28- $ this ->assertEquals ($ aggregateId , $ message ->getId ());
29- $ this ->assertEquals ($ version , $ message ->getVersion ());
30- $ this ->assertEquals ($ payload , $ message ->getPayload ());
28+ $ this ->assertSame ($ aggregateId , $ message ->getId ());
29+ $ this ->assertSame ($ version , $ message ->getVersion ());
30+ $ this ->assertSame ($ payload , $ message ->getPayload ());
3131 $ this ->assertEquals ($ date , $ message ->getRecordedOn ());
32+ $ this ->assertEquals (new \DateTimeZone ('UTC ' ), $ message ->getRecordedOn ()->getTimezone ());
3233 }
3334
3435 /**
@@ -47,14 +48,23 @@ public function itShouldCreateAUuidFromNamedConstructor(
4748 ) {
4849 $ message = DomainMessage::recordNow ($ aggregateId , $ version , $ payload );
4950 $ this ->assertInstanceOf (DomainMessage::class, $ message );
51+
52+ $ this ->assertNotEmpty ((int )$ message ->getRecordedOn ()->format ('u ' ), 'Expected microseconds to be set ' );
53+ $ this ->assertEquals (new \DateTimeZone ('UTC ' ), $ message ->getRecordedOn ()->getTimezone ());
5054 }
5155
5256 public function messageProvider ()
5357 {
5458 return [
5559 [AggregateId::generate (), 1 , new SomethingHappened (), new \DateTimeImmutable ()],
5660 [AggregateId::generate (), 100 , new SomethingHappened (), new \DateTimeImmutable ()],
57- [AggregateId::generate (), 9999999 , new SomethingHappened (), new \DateTimeImmutable ()]
61+ [AggregateId::generate (), 9999999 , new SomethingHappened (), new \DateTimeImmutable ()],
62+ [
63+ AggregateId::generate (),
64+ 9999999 ,
65+ new SomethingHappened (),
66+ \DateTimeImmutable::createFromFormat ('U.u ' , sprintf ('%.6F ' , microtime (true )))
67+ ]
5868 ];
5969 }
6070}
0 commit comments