diff options
Diffstat (limited to 'tests/temporal/Workflow/WaitWorkflow.php')
-rw-r--r-- | tests/temporal/Workflow/WaitWorkflow.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/temporal/Workflow/WaitWorkflow.php b/tests/temporal/Workflow/WaitWorkflow.php new file mode 100644 index 00000000..826952c1 --- /dev/null +++ b/tests/temporal/Workflow/WaitWorkflow.php @@ -0,0 +1,33 @@ +<?php + + +namespace Temporal\Tests\Workflow; + + +use Temporal\Workflow; +use Temporal\Workflow\SignalMethod; +use Temporal\Workflow\WorkflowInterface; +use Temporal\Workflow\WorkflowMethod; + +#[WorkflowInterface] +class WaitWorkflow +{ + private bool $ready = false; + private string $value; + + #[SignalMethod] + public function unlock( + string $value + ) { + $this->ready = true; + $this->value = $value; + } + + #[WorkflowMethod(name: 'WaitWorkflow')] + public function run() + { + yield Workflow::await(fn() => $this->ready); + + return $this->value; + } +} |