From c5b4900ffcfde26b787a95ead6e3bd89baa54965 Mon Sep 17 00:00:00 2001 From: Julien Nahum Date: Wed, 18 Dec 2024 13:12:23 +0100 Subject: [PATCH] Enhance hCaptcha integration in tests and configuration - Added hCaptcha site and secret keys to phpunit.xml for testing purposes. - Updated RegisterTest to configure hCaptcha secret key dynamically, ensuring proper token validation in production environment. These changes improve the testing setup for hCaptcha, facilitating more accurate simulation of production conditions. --- api/phpunit.xml | 2 ++ api/tests/Feature/RegisterTest.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/phpunit.xml b/api/phpunit.xml index 52e0c90b..b16ee9a2 100644 --- a/api/phpunit.xml +++ b/api/phpunit.xml @@ -27,6 +27,8 @@ + + diff --git a/api/tests/Feature/RegisterTest.php b/api/tests/Feature/RegisterTest.php index 3b3e8cd1..598374cd 100644 --- a/api/tests/Feature/RegisterTest.php +++ b/api/tests/Feature/RegisterTest.php @@ -77,7 +77,7 @@ }); it('requires hcaptcha token in production', function () { - app()->detectEnvironment(fn () => 'production'); + config(['services.h_captcha.secret_key' => 'test-key']); Http::fake([ ValidHCaptcha::H_CAPTCHA_VERIFY_URL => Http::response(['success' => true])