newInstanceWithoutConstructor(); $method = new ReflectionMethod(Database::class, 'normalizeHost'); $method->setAccessible(true); return $method->invoke($instance, $host); } public function testNullHostPassesThroughInsteadOfThrowing(): void { // Regression: a null host (the no-arg DatabaseHandler() boot path) must // not raise a TypeError. $this->assertNull($this->normalize(null)); } public function testLocalhostIsForcedToTcpLoopback(): void { $this->assertSame('127.0.0.1', $this->normalize('localhost')); } public function testOtherHostsAreUnchanged(): void { $this->assertSame('db.internal', $this->normalize('db.internal')); $this->assertSame('10.0.0.5', $this->normalize('10.0.0.5')); } }