Skip to content

Commit 870c1dd

Browse files
committed
Refactor StartWorkflowTestCase
(cherry picked from commit 359881e)
1 parent 0a7dda2 commit 870c1dd

1 file changed

Lines changed: 3 additions & 31 deletions

File tree

tests/Unit/Router/StartWorkflowTestCase.php

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Temporal\DataConverter\EncodedValues;
1616
use Temporal\Exception\ExceptionInterceptorInterface;
1717
use Temporal\Interceptor\SimplePipelineProvider;
18-
use Temporal\Interceptor\WorkflowInboundCallsInterceptor;
1918
use Temporal\Internal\Declaration\Destroyable;
2019
use Temporal\Internal\Declaration\Prototype\WorkflowPrototype;
2120
use Temporal\Internal\Declaration\Reader\WorkflowReader;
@@ -76,42 +75,15 @@ public function testStartingAlreadyRunningWorkflow(): void
7675
$workflowInfo = new WorkflowInfo();
7776
$workflowInfo->type->name = 'DummyWorkflow';
7877
$workflowInfo->execution = new WorkflowExecution('123', (string) $request->getID());
78+
$this->services->running->add($this->createIdentifiable($request->getID()));
7979

8080
$this->marshaller->expects($this->once())
8181
->method('unmarshal')
8282
->willReturn(new Input($workflowInfo));
8383

84-
$identify = $this->createIdentifiable($request->getID());
84+
$this->expectException(\OutOfBoundsException::class);
8585

86-
$this->services->running->add($identify);
87-
88-
try {
89-
$this->router->handle($request, [], new Deferred());
90-
} catch (\LogicException $exception) {
91-
$this->fail($exception->getMessage());
92-
}
93-
}
94-
95-
public function testAlreadyRunningWorkflowIsReturned(): void
96-
{
97-
$request = new Request(Uuid::v4(), DummyWorkflow::class, EncodedValues::fromValues([]));
98-
99-
$workflowInfo = new WorkflowInfo();
100-
$workflowInfo->type->name = 'DummyWorkflow';
101-
$workflowInfo->execution = new WorkflowExecution('123', (string) $request->getID());
102-
103-
$this->marshaller->expects($this->once())
104-
->method('unmarshal')
105-
->willReturn(new Input($workflowInfo));
106-
107-
$identify = $this->createIdentifiable($request->getID());
108-
$this->services->running->add($identify);
109-
110-
try {
111-
$this->router->handle($request, [], new Deferred());
112-
} catch (\LogicException $exception) {
113-
$this->fail($exception->getMessage());
114-
}
86+
$this->router->handle($request, [], new Deferred());
11587
}
11688

11789
protected function setUp(): void

0 commit comments

Comments
 (0)