コード例 #1
0
 /**
  * @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());
 }
コード例 #2
0
 /**
  * @param SerializedMessageObject $object
  * @return Payload
  */
 protected function payload(SerializedMessageObject $object)
 {
     return $this->serializer->deserialize($object);
 }