classifier = new HostnameClassifier(); } public function localHostnamesData():array { return [ ['localhost'], ['localHost'], ['random-host'], ['another-host.local'], ['service.localhost'], ['randomdomain.internal'], ]; } /** * @dataProvider localHostnamesData */ public function testLocalHostname(string $host): void { $isLocal = $this->classifier->isLocalHostname($host); self::assertTrue($isLocal); } public function publicHostnamesData(): array { return [ ['example.com'], ['example.net'], ['example.org'], ['host.domain'], ['cloud.domain.tld'], ]; } /** * @dataProvider publicHostnamesData */ public function testPublicHostname(string $host): void { $isLocal = $this->classifier->isLocalHostname($host); self::assertFalse($isLocal); } }