createWorkflow([ 'root' => ['a'], 'a' => [], 'b' => [], ]); $this->expectException(UnexpectedValueException::class); $this->expectExceptionMessage('Invalid automation structure: Unreachable steps found in automation graph'); (new WorkflowWalker())->walk($workflow, [new NoUnreachableStepsRule()]); } public function testItDetectsUnreachableSubgraphs(): void { $workflow = $this->createWorkflow([ 'root' => ['a'], 'a' => [], 'b' => ['c'], 'c' => [], ]); $this->expectException(UnexpectedValueException::class); $this->expectExceptionMessage('Invalid automation structure: Unreachable steps found in automation graph'); $walker = new WorkflowWalker(); (new WorkflowWalker())->walk($workflow, [new NoUnreachableStepsRule()]); } public function testItPassesWithSimplePath(): void { $workflow = $this->createWorkflow([ 'root' => ['a'], 'a' => ['b'], 'b' => ['c'], 'c' => [], ]); (new WorkflowWalker())->walk($workflow, [new NoUnreachableStepsRule()]); // no exception thrown } }