diff --git a/features/continue_as_new/continue_as_same/feature.php b/features/continue_as_new/continue_as_same/feature.php new file mode 100644 index 00000000..9fd051aa --- /dev/null +++ b/features/continue_as_new/continue_as_same/feature.php @@ -0,0 +1,57 @@ +continuedExecutionRunId)) { + return $input; + } + + return yield Workflow::continueAsNew( + 'Workflow', + args: [$input], + ); + } +} + +class FeatureChecker +{ + #[Check] + public static function check( + #[Stub( + type: 'Workflow', + workflowId: WORKFLOW_ID, + args: [INPUT_DATA], + memo: [MEMO_KEY => MEMO_VALUE], + )] + WorkflowStubInterface $stub + ): void { + Assert::same($stub->getResult(), INPUT_DATA); + # Workflow ID was not changed after continue as new + Assert::same($stub->getExecution()->getID(), WORKFLOW_ID); + # Memos do not change after continue as new + $description = $stub->describe(); + Assert::same($description->info->memo->getValues(), [MEMO_KEY => MEMO_VALUE]); + } +} + \ No newline at end of file diff --git a/features/schedule/basic/feature.php b/features/schedule/basic/feature.php index 030d3769..915cb1bd 100644 --- a/features/schedule/basic/feature.php +++ b/features/schedule/basic/feature.php @@ -42,7 +42,6 @@ public static function check( Feature $feature, State $runtime, ): void { - throw new SkipTest('TODO: https://github.com/temporalio/features/issues/580'); $workflowId = Uuid::uuid4()->toString(); $scheduleId = Uuid::uuid4()->toString(); $interval = CarbonInterval::seconds(2); diff --git a/harness/php/composer.json b/harness/php/composer.json index 8473a519..cca01066 100644 --- a/harness/php/composer.json +++ b/harness/php/composer.json @@ -8,7 +8,7 @@ "buggregator/trap": "^1.9", "spiral/core": "^3.13", "symfony/process": ">=6.4", - "temporal/sdk": "^2.12.3", + "temporal/sdk": "^2.13.2", "webmozart/assert": "^1.11" }, "autoload": { diff --git a/harness/php/runner.php b/harness/php/runner.php index b096b963..fadd78e1 100644 --- a/harness/php/runner.php +++ b/harness/php/runner.php @@ -70,13 +70,13 @@ serviceClient: $serviceClient, options: (new ClientOptions())->withNamespace($runtime->namespace), converter: $converter, -)->withTimeout(5); +)->withTimeout(10); $scheduleClient = ScheduleClient::create( serviceClient: $serviceClient, options: (new ClientOptions())->withNamespace($runtime->namespace), converter: $converter, -)->withTimeout(5); +)->withTimeout(10); $container = new Spiral\Core\Container(); $container->bindSingleton(State::class, $runtime); diff --git a/harness/php/src/Feature/WorkflowStubInjector.php b/harness/php/src/Feature/WorkflowStubInjector.php index b8bb864f..9cc36ac0 100644 --- a/harness/php/src/Feature/WorkflowStubInjector.php +++ b/harness/php/src/Feature/WorkflowStubInjector.php @@ -12,6 +12,7 @@ use Spiral\Core\Container\InjectorInterface; use Temporal\Client\WorkflowOptions; use Temporal\Client\WorkflowStubInterface; +use Temporal\Common\IdReusePolicy; /** * @implements InjectorInterface @@ -51,6 +52,7 @@ public function createInjection( $feature = $this->container->get(Feature::class); $options = WorkflowOptions::new() ->withTaskQueue($feature->taskQueue) + ->withWorkflowIdReusePolicy(IdReusePolicy::AllowDuplicate) ->withEagerStart($attribute->eagerStart); $attribute->workflowId === null or $options = $options->withWorkflowId($attribute->workflowId);