diff options
Diffstat (limited to 'tests/temporal/Workflow/AggregatedWorkflow.php')
-rw-r--r-- | tests/temporal/Workflow/AggregatedWorkflow.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/temporal/Workflow/AggregatedWorkflow.php b/tests/temporal/Workflow/AggregatedWorkflow.php new file mode 100644 index 00000000..3299179e --- /dev/null +++ b/tests/temporal/Workflow/AggregatedWorkflow.php @@ -0,0 +1,30 @@ +<?php + +namespace Temporal\Tests\Workflow; + +use Temporal\Workflow; +use Temporal\Workflow\SignalMethod; +use Temporal\Workflow\WorkflowInterface; +use Temporal\Workflow\WorkflowMethod; + +#[WorkflowInterface] +class AggregatedWorkflow +{ + private array $values = []; + + #[SignalMethod] + public function addValue( + string $value + ) { + $this->values[] = $value; + } + + #[WorkflowMethod(name: 'AggregatedWorkflow')] + public function run( + int $count + ) { + yield Workflow::await(fn() => count($this->values) === $count); + + return $this->values; + } +} |