'System Default', 'en_GB' => 'en_GB'); if (!function_exists('configSelectChoices')) { echo "FAIL - configSelectChoices() is not defined in web/includes/config_values.php\n"; $failed = true; } else { $r = configSelectChoices($choices, 'en_GB.UTF-8'); $ok = is_array($r) && array_key_exists('en_GB.UTF-8', $r) && array_key_exists('', $r) && array_key_exists('en_GB', $r) && count($r) === 3; $failed = !check($ok, 'saved value en_GB.UTF-8 added as a choice and original 2 keys kept') || $failed; $r = configSelectChoices($choices, 'en_GB'); $ok = is_array($r) && count($r) === 2 && array_key_exists('', $r) && array_key_exists('en_GB', $r); $failed = !check($ok, 'saved value already in choices returns the 2 choices unchanged') || $failed; $r = configSelectChoices($choices, ''); $ok = is_array($r) && count($r) === 2; $failed = !check($ok, 'empty saved value returns the 2 choices unchanged') || $failed; } $path = $root.'/web/skins/classic/views/options.php'; $src = @file_get_contents($path); if ($src === false) { echo "FAIL - could not read web/skins/classic/views/options.php\n"; $failed = true; } else { $calls = substr_count($src, 'htmlSelect("newConfig[$name]"'); $uses = substr_count($src, 'configSelectChoices('); $failed = !check($calls === 2 && $uses >= 2, 'both htmlSelect("newConfig[$name]", ...) calls use configSelectChoices()') || $failed; } exit($failed ? 1 : 0);