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