Skip to content

Commit caef900

Browse files
authored
Merge pull request #1 from coderflexx/refactoring
Fix Known Bug
2 parents 96c3293 + 1c66a35 commit caef900

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

composer.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
],
2020
"require": {
2121
"php": "^8.1",
22-
"spatie/laravel-package-tools": "^1.14.0",
23-
"illuminate/contracts": "^10.0"
22+
"guzzlehttp/guzzle": "^7.7",
23+
"illuminate/contracts": "^10.0",
24+
"spatie/laravel-package-tools": "^1.14.0"
2425
},
2526
"require-dev": {
2627
"laravel/pint": "^1.0",
@@ -71,4 +72,4 @@
7172
},
7273
"minimum-stability": "dev",
7374
"prefer-stable": true
74-
}
75+
}
File renamed without changes.
File renamed without changes.

tests/TurnstileTest.php

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?php
22

3+
use Coderflex\LaravelTurnstile\Rules\TurnstileCheck;
4+
use Illuminate\Support\Facades\Config;
5+
36
it('returns success message', function () {
47
setTurnstileRoutes(true);
58

@@ -11,3 +14,16 @@
1114

1215
$response->assertOk();
1316
});
17+
18+
it('fails validation for invalid input', function () {
19+
Config::set('turnstile', [
20+
'turnstile_site_key' => '2x00000000000000000000AB',
21+
'turnstile_secret_key' => '2x0000000000000000000000000000000AA',
22+
]);
23+
24+
$rule = new TurnstileCheck();
25+
26+
$result = $rule->validate('cf-turnstile-response', 'invalid_input', fn () => '');
27+
28+
expect($result)->toBeNull();
29+
});

0 commit comments

Comments
 (0)