"example.com, ALT.example.com\n third.example.com", 'appname_1' => '一号站', 'host_2' => 'https://BETA.example.com:443/path', 'appname_2' => '二号站', 'host_3' => 'blank.example.com', 'appname_3' => " \t", 'host_4' => 'port.example.com:8080', 'appname_4' => '四号站', ]; $cases = [ ['example.com', '默认站', '一号站', 'Exact host mapping failed'], ['ALT.EXAMPLE.COM:9443', '默认站', '一号站', 'Comma-separated host or case/port normalization failed'], ['third.example.com', '默认站', '一号站', 'Whitespace-separated host mapping failed'], ['beta.example.com', '默认站', '二号站', 'Configured URL host normalization failed'], ['https://BETA.EXAMPLE.COM:8443/another', '默认站', '二号站', 'Request URL host normalization failed'], ['port.example.com', '默认站', '四号站', 'Configured host port normalization failed'], ['blank.example.com', '默认站', '默认站', 'Blank mapped site name did not use the admin default'], ['unknown.example.com', '默认站', '默认站', 'Unmapped host did not use the admin default'], ['', '默认站', '默认站', 'Missing request host did not use the admin default'], ['blank.example.com', '', '站点', 'Blank mapped and admin default names did not use the fixed fallback'], ['unknown.example.com', " \t", '站点', 'Blank admin default did not use the fixed fallback'], ]; foreach ($cases as [$host, $defaultName, $expected, $message]) { expectSiteName(SiteName::resolveFromConfig($host, $defaultName, $mappings), $expected, $message); } $exampleConfig = file_get_contents(dirname(__DIR__) . '/config/.config.php.example'); if ($exampleConfig === false) { fwrite(STDERR, 'Could not read the example configuration.' . PHP_EOL); exit(1); } expectSiteName( preg_match('/\$System_Config\s*\[\s*[\'\"]appName[\'\"]\s*\]/', $exampleConfig), 0, 'The example configuration still defines or directly references the legacy appName key' ); echo 'Site name checks passed.' . PHP_EOL;