FakeNode::any(), 'bar' => FakeNode::any(), ]; $node = FakeNode::branch($children); $visited = [...(new NodeTraverser( fn (Node $node) => $node ))->traverse($node)]; self::assertContains($node, $visited); self::assertContains($children['foo'], $visited); self::assertContains($children['bar'], $visited); } }