File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,8 +127,12 @@ public function active(): self
127127 $ active = $ this ->fresh ();
128128
129129 if ($ active ->status ::class === WorkflowContinuedStatus::class) {
130- $ active = $ this ->activeWorkflow ()
130+ $ continued = $ this ->activeWorkflow ()
131131 ->first ();
132+
133+ if ($ continued !== null ) {
134+ $ active = $ continued ;
135+ }
132136 }
133137
134138 return $ active ;
Original file line number Diff line number Diff line change @@ -233,4 +233,20 @@ public function testActiveWorkflowWithMultipleContinuations(): void
233233
234234 $ this ->assertSame ($ finalWorkflow ->id , $ active ->id );
235235 }
236+
237+ public function testActiveWithContinuedStatusButNoActiveChild (): void
238+ {
239+ $ workflow = StoredWorkflow::create ([
240+ 'class ' => 'TestWorkflow ' ,
241+ 'status ' => WorkflowRunningStatus::class,
242+ 'arguments ' => json_encode ([]),
243+ ]);
244+
245+ $ workflow ->status ->transitionTo (WorkflowContinuedStatus::class);
246+
247+ $ active = $ workflow ->active ();
248+
249+ $ this ->assertNotNull ($ active );
250+ $ this ->assertSame ($ workflow ->id , $ active ->id );
251+ }
236252}
You can’t perform that action at this time.
0 commit comments