/**
  * @covers \PhpCqrs\Domain\Serializer\SerializedObject::__construct
  * @covers \PhpCqrs\Domain\Serializer\SerializedObject::name
  * @covers \PhpCqrs\Domain\Serializer\SerializedObject::payload
  */
 public function testCanConstruct()
 {
     $name = 'stdClass';
     $payload = ['payload'];
     $object = new SerializedObject($name, $payload);
     $this->assertSame($name, $object->name());
     $this->assertSame($payload, $object->payload());
 }
Esempio n. 2
0
 /**
  * @param SerializedObject $object
  * @return Serializable
  * @throws Exception
  */
 public function deserialize(SerializedObject $object)
 {
     $name = $object->name();
     return call_user_func([$name, 'deserialize'], $object->payload());
 }