diff options
Diffstat (limited to 'tests/temporal/Workflow/SideEffectWorkflow.php')
-rw-r--r-- | tests/temporal/Workflow/SideEffectWorkflow.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/temporal/Workflow/SideEffectWorkflow.php b/tests/temporal/Workflow/SideEffectWorkflow.php new file mode 100644 index 00000000..95d396e4 --- /dev/null +++ b/tests/temporal/Workflow/SideEffectWorkflow.php @@ -0,0 +1,30 @@ +<?php + +namespace Temporal\Tests\Workflow; + +use Temporal\Activity\ActivityOptions; +use Temporal\Common\Uuid; +use Temporal\Workflow; +use Temporal\Workflow\WorkflowMethod; +use Temporal\Tests\Activity\SimpleActivity; + +#[Workflow\WorkflowInterface] +class SideEffectWorkflow +{ + #[WorkflowMethod(name: 'SideEffectWorkflow')] + public function handler(string $input): iterable + { + $simple = Workflow::newActivityStub( + SimpleActivity::class, + ActivityOptions::new()->withStartToCloseTimeout(5) + ); + + $result = yield Workflow::sideEffect( + function () use ($input) { + return $input . '-42'; + } + ); + + return yield $simple->lower($result); + } +} |