修复国家设置,允许不设置任何国家,不做判断

This commit is contained in:
root
2026-06-20 04:09:37 +08:00
parent 6b3b99b0f1
commit 24ff3f9657
11 changed files with 188 additions and 23 deletions
+8 -1
View File
@@ -56,9 +56,16 @@ if ($tests['resolver_available']) {
$tests['normalize_name'] = CountryCodeNormalizer::toAlpha2('United States') === 'US';
$tests['allowlist_name'] = CountryAllowlist::isAllowed('United Kingdom', CountryAllowlist::parse('GB,US'));
$tests['allowlist_fullwidth_comma'] = CountryAllowlist::isAllowed('BR', CountryAllowlist::parse('BRCN'));
$tests['allowlist_semicolon'] = CountryAllowlist::isAllowed('GB', CountryAllowlist::parse('US;GB;CA'));
$tests['allowlist_country_name'] = CountryAllowlist::isAllowed('BR', CountryAllowlist::parse('Brazil,China'));
if (!$tests['normalize_iso2'] || !$tests['normalize_name'] || !$tests['allowlist_name']
|| !$tests['allowlist_fullwidth_comma'] || !$tests['allowlist_country_name']) {
|| !$tests['allowlist_fullwidth_comma'] || !$tests['allowlist_semicolon'] || !$tests['allowlist_country_name']) {
$ok = false;
}
$tests['is_enabled_empty'] = CountryAllowlist::isEnabled('') === false;
$tests['is_enabled_us'] = CountryAllowlist::isEnabled('US,GB') === true;
if (!$tests['is_enabled_empty'] || !$tests['is_enabled_us']) {
$ok = false;
}
}