summaryrefslogtreecommitdiff
path: root/tests/temporal/Workflow/ChildStubWorkflow.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/temporal/Workflow/ChildStubWorkflow.php')
-rw-r--r--tests/temporal/Workflow/ChildStubWorkflow.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/temporal/Workflow/ChildStubWorkflow.php b/tests/temporal/Workflow/ChildStubWorkflow.php
new file mode 100644
index 00000000..608962c2
--- /dev/null
+++ b/tests/temporal/Workflow/ChildStubWorkflow.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Temporal\Tests\Workflow;
+
+use Temporal\Workflow;
+use Temporal\Workflow\WorkflowMethod;
+
+#[Workflow\WorkflowInterface]
+class ChildStubWorkflow
+{
+ #[WorkflowMethod(name: 'ChildStubWorkflow')]
+ public function handler(
+ string $input
+ ) {
+ // typed stub
+ $simple = Workflow::newChildWorkflowStub(SimpleWorkflow::class);
+
+ $result = [];
+ $result[] = yield $simple->handler($input);
+
+ // untyped
+ $untyped = Workflow::newUntypedChildWorkflowStub('SimpleWorkflow');
+ $result[] = yield $untyped->execute(['untyped']);
+
+ $execution = yield $untyped->getExecution();
+ assert($execution instanceof Workflow\WorkflowExecution);
+
+ return $result;
+ }
+}