Skip to content

Commit

Permalink
Merge pull request #1 from coderflexx/refactoring
Browse files Browse the repository at this point in the history
Fix Known Bug
  • Loading branch information
ousid authored May 30, 2023
2 parents 96c3293 + 1c66a35 commit caef900
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -71,4 +72,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions tests/TurnstileTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

use Coderflex\LaravelTurnstile\Rules\TurnstileCheck;
use Illuminate\Support\Facades\Config;

it('returns success message', function () {
setTurnstileRoutes(true);

Expand All @@ -11,3 +14,16 @@

$response->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();
});

0 comments on commit caef900

Please sign in to comment.