From a7a276e877b8482c08679e87dca72276ad3671fa Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 4 Apr 2026 19:55:31 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20[testing=20improvement]=20Add=20?= =?UTF-8?q?test=20for=20case-insensitive=20hostname=20matching?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added testVerifyHostnameMatchCaseInsensitive to ReCaptchaTest.php. - Verified that the test correctly handles mismatched casing between expected and actual hostnames. - Confirmed that the test fails if case-insensitive matching is disabled. Co-authored-by: rowan-m <108052+rowan-m@users.noreply.github.com> --- tests/ReCaptcha/ReCaptchaTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/ReCaptcha/ReCaptchaTest.php b/tests/ReCaptcha/ReCaptchaTest.php index d734163..eb98bbb 100644 --- a/tests/ReCaptcha/ReCaptchaTest.php +++ b/tests/ReCaptcha/ReCaptchaTest.php @@ -178,6 +178,19 @@ public function testVerifyHostnameMisMatch(): void $this->assertEquals([ReCaptcha::E_HOSTNAME_MISMATCH], $response->getErrorCodes()); } + public function testVerifyHostnameMatchCaseInsensitive(): void + { + $method = $this->getMockRequestMethod('{"success": true, "hostname": "host.name"}'); + $rc = new ReCaptcha('secret', $method); + $response = $rc->setExpectedHostname('HOST.NAME')->verify('response'); + $this->assertTrue($response->isSuccess()); + + $method = $this->getMockRequestMethod('{"success": true, "hostname": "HOST.NAME"}'); + $rc = new ReCaptcha('secret', $method); + $response = $rc->setExpectedHostname('host.name')->verify('response'); + $this->assertTrue($response->isSuccess()); + } + public function testVerifyApkPackageNameMatch(): void { $method = $this->getMockRequestMethod('{"success": true, "apk_package_name": "apk.name"}');