/** * @test */ public function it_returns_start_sub_process_command_including_previous_message() { $subProcessDefinition = ["process_type" => Definition::PROCESS_LINEAR_MESSAGING, "tasks" => [["task_type" => Definition::TASK_COLLECT_DATA, "source" => 'test-case', "processing_type" => 'Prooph\\ProcessingTest\\Mock\\UserDictionary']]]; $task = RunSubProcess::setUp(NodeName::defaultName(), $subProcessDefinition); $parentTaskListPosition = TaskListPosition::at(TaskListId::linkWith(NodeName::defaultName(), ProcessId::generate()), 1); $previousMessage = WorkflowMessage::newDataCollected(UserDictionary::fromNativeValue(['id' => 1, 'name' => 'John Doe', 'address' => ['street' => 'Main Street', 'streetNumber' => 10, 'zip' => '12345', 'city' => 'Test City']]), 'test-case', NodeName::defaultName()); $startSubProcess = $task->generateStartCommandForSubProcess($parentTaskListPosition, $previousMessage); $this->assertTrue($parentTaskListPosition->equals($startSubProcess->parentTaskListPosition())); $this->assertEquals($subProcessDefinition, $startSubProcess->subProcessDefinition()); $this->assertEquals($previousMessage->messageName(), $startSubProcess->previousWorkflowMessage()->messageName()); }
/** * @param array $taskDefinition * @return RunSubProcess */ private function createRunSubProcessTaskFromDefinition(array $taskDefinition) { Assertion::keyExists($taskDefinition, "target_node_name"); Assertion::keyExists($taskDefinition, "process_definition"); Assertion::isArray($taskDefinition["process_definition"]); return RunSubProcess::setUp(NodeName::fromString($taskDefinition['target_node_name']), $taskDefinition["process_definition"]); }