From bf33938e6ff1a35fec480c77169d171314b94484 Mon Sep 17 00:00:00 2001 From: Aleksei Gagarin Date: Tue, 7 Jan 2025 18:59:57 +0400 Subject: [PATCH] Fix issue when a workflow stub without defined Type runs an update method (#547) --- psalm-baseline.xml | 1 - src/Internal/Client/ResponseToResultMapper.php | 2 +- tests/Acceptance/Extra/Update/UntypedStubTest.php | 13 +++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 298b54e1..73bbf9d6 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -428,7 +428,6 @@ getFailure()]]> getResult()]]> workflowType]]> - workflowType]]> getQueryResult()]]> execution]]> execution]]> diff --git a/src/Internal/Client/ResponseToResultMapper.php b/src/Internal/Client/ResponseToResultMapper.php index cad78996..1ad89104 100644 --- a/src/Internal/Client/ResponseToResultMapper.php +++ b/src/Internal/Client/ResponseToResultMapper.php @@ -25,7 +25,7 @@ public function __construct( public function mapUpdateWorkflowResponse( UpdateWorkflowExecutionResponse $result, string $updateName, - string $workflowType, + ?string $workflowType, WorkflowExecution $workflowExecution, ): StartUpdateOutput { $outcome = $result->getOutcome(); diff --git a/tests/Acceptance/Extra/Update/UntypedStubTest.php b/tests/Acceptance/Extra/Update/UntypedStubTest.php index f43e7c81..ef0daee6 100644 --- a/tests/Acceptance/Extra/Update/UntypedStubTest.php +++ b/tests/Acceptance/Extra/Update/UntypedStubTest.php @@ -68,6 +68,19 @@ public function fetchResultWithTimeout( $this->assertSame(['key' => null], (array)$result, 'Workflow result contains resolved value'); } + #[Test] + public function useClientRunningWorkflowStub( + #[Stub('Extra_Update_UntypedStub')] WorkflowStubInterface $stub, + WorkflowClientInterface $client, + ): void { + $untyped = $client->newUntypedRunningWorkflowStub( + $stub->getExecution()->getID(), + $stub->getExecution()->getRunID(), + ); + + $this->fetchResolvedResultAfterWorkflowCompleted($untyped); + } + #[Test] public function handleUnknownUpdate( #[Stub('Extra_Update_UntypedStub')] WorkflowStubInterface $stub,