From 986c365a65495a76022fbaa15a576277f239dbf7 Mon Sep 17 00:00:00 2001 From: ousid Date: Tue, 30 May 2023 14:22:52 +0100 Subject: [PATCH 1/2] fix bug --- composer.json | 7 ++++--- .../{TrunstileCheck.php => TurnstileCheck.php} | 0 tests/TurnstileTest.php | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) rename src/Rules/{TrunstileCheck.php => TurnstileCheck.php} (100%) diff --git a/composer.json b/composer.json index 72a713c..be957e5 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,9 @@ ], "require": { "php": "^8.1", - "spatie/laravel-package-tools": "^1.14.0", - "illuminate/contracts": "^10.0" + "guzzlehttp/guzzle": "^7.7", + "illuminate/contracts": "^10.0", + "spatie/laravel-package-tools": "^1.14.0" }, "require-dev": { "laravel/pint": "^1.0", @@ -71,4 +72,4 @@ }, "minimum-stability": "dev", "prefer-stable": true -} \ No newline at end of file +} diff --git a/src/Rules/TrunstileCheck.php b/src/Rules/TurnstileCheck.php similarity index 100% rename from src/Rules/TrunstileCheck.php rename to src/Rules/TurnstileCheck.php diff --git a/tests/TurnstileTest.php b/tests/TurnstileTest.php index b0f331b..c285914 100644 --- a/tests/TurnstileTest.php +++ b/tests/TurnstileTest.php @@ -1,5 +1,8 @@ assertOk(); }); + +it('fails validation for invalid input', function () { + Config::set('turnstile', [ + 'turnstile_site_key' => '2x00000000000000000000AB', + 'turnstile_secret_key' => '2x0000000000000000000000000000000AA', + ]); + + $rule = new TurnstileCheck(); + + $result = $rule->validate('cf-turnstile-response', 'invalid_input', fn () => ''); + + expect($result)->toBeNull(); +}); From 1c66a35a9395747397036b44bde910702968c03f Mon Sep 17 00:00:00 2001 From: ousid Date: Tue, 30 May 2023 14:26:49 +0100 Subject: [PATCH 2/2] update turnstile widget name --- src/Components/{Widget.php => TurnstileWidget.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/Components/{Widget.php => TurnstileWidget.php} (100%) diff --git a/src/Components/Widget.php b/src/Components/TurnstileWidget.php similarity index 100% rename from src/Components/Widget.php rename to src/Components/TurnstileWidget.php