/** * @covers \PhpCqrs\Domain\Serializer\Serializer::deserialize */ public function testCanDeserializeObject() { $object = new SerializedObject('PhpCqrs\\Helpers\\Domain\\Event\\BookRegistered', ['id' => '1234', 'title' => 'Title!']); $serializer = new Serializer(); $payload = $serializer->deserialize($object); /** @var BookRegistered $payload */ $this->assertInstanceOf(BookRegistered::class, $payload); $this->assertSame('Title!', $payload->title()); $this->assertSame('1234', $payload->id()); }
/** * @param SerializedMessageObject $object * @return Payload */ protected function payload(SerializedMessageObject $object) { return $this->serializer->deserialize($object); }