fix: verify option writes before treating update_option() false as failure

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-26 00:47:35 +02:00
co-authored by Claude Opus 5.5
parent 9cc9d4f2dc
commit fc216e3eaf
4 changed files with 109 additions and 12 deletions
@@ -71,6 +71,17 @@ final class SettingsWhitelistTest extends TestCase
self::assertSame('', $whitelist->normalize('WPLANG', 'en_US'));
}
public function testWplangAcceptsOnlyTheEnUsSentinelNotTheRawEmptyString(): void
{
// '' is WordPress' internal storage form for English (see current()/normalize());
// clients must say en_US, never the internal '', which is also not an installed
// language code and would otherwise be rejected as "not installed" anyway.
Functions\when('get_available_languages')->justReturn(['de_DE']);
$whitelist = new SettingsWhitelist();
self::assertNotNull($whitelist->validate('WPLANG', '', []));
}
public function testCurrentNormalizesLanguageAndNumbers(): void
{
Functions\when('get_option')->alias(static fn (string $key) => ['WPLANG' => '', 'page_on_front' => '5'][$key]);