/** * @param Prototype $aPrototype * @param string|NodeName $origin * @param string|NodeName $target * @param array $metadata * @return WorkflowMessage */ public static function collectDataOf(Prototype $aPrototype, $origin, $target, array $metadata = []) { $messageName = MessageNameUtils::getCollectDataCommandName($aPrototype->of()); return new static(Payload::fromPrototype($aPrototype), $messageName, $origin, $target, $metadata); }
/** * @test */ public function it_encodes_and_decodes_payload_with_prototype_to_and_from_json() { $payload = Payload::fromPrototype(UserDictionary::prototype()); $jsonString = json_encode($payload); $jsonDecodedData = json_decode($jsonString, true); $decodedPayload = Payload::fromJsonDecodedData($jsonDecodedData); $this->assertEquals('Prooph\\ProcessingTest\\Mock\\UserDictionary', $decodedPayload->getTypeClass()); }