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/Components/Widget.php b/src/Components/TurnstileWidget.php similarity index 100% rename from src/Components/Widget.php rename to src/Components/TurnstileWidget.php 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(); +});