-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
176 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Coderflex\FilamentTurnstile\Tests\Database\Factories; | ||
|
||
use Coderflex\FilamentTurnstile\Tests\Models\User; | ||
|
||
class UserFactory extends \Orchestra\Testbench\Factories\UserFactory | ||
{ | ||
protected $model = User::class; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration | ||
{ | ||
public function up() | ||
{ | ||
Schema::create('users', function (Blueprint $table) { | ||
$table->id(); | ||
$table->string('name'); | ||
$table->string('email')->unique(); | ||
$table->timestamp('email_verified_at')->nullable(); | ||
$table->string('password'); | ||
$table->rememberToken(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Coderflex\FilamentTurnstile\Tests\Fixtures; | ||
|
||
use Coderflex\FilamentTurnstile\Forms\Components\Turnstile; | ||
|
||
class Register extends \Filament\Pages\Auth\Register | ||
{ | ||
protected function getForms(): array | ||
{ | ||
return [ | ||
'form' => $this->form( | ||
$this->makeForm() | ||
->schema([ | ||
$this->getNameFormComponent(), | ||
$this->getEmailFormComponent(), | ||
$this->getPasswordFormComponent(), | ||
$this->getPasswordConfirmationFormComponent(), | ||
Turnstile::make('cf-captcha') | ||
->theme('auto'), | ||
]) | ||
->statePath('data'), | ||
), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Coderflex\FilamentTurnstile\Tests\Fixtures; | ||
|
||
use Filament\Http\Middleware\Authenticate; | ||
use Filament\Panel; | ||
use Filament\PanelProvider; | ||
|
||
class TurnstilePanelProvider extends PanelProvider | ||
{ | ||
public function panel(Panel $panel): Panel | ||
{ | ||
return $panel | ||
->id('turnstile') | ||
->path('filament') | ||
->authMiddleware([ | ||
Authenticate::class, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Coderflex\FilamentTurnstile\Tests\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Foundation\Auth\User as Authenticatable; | ||
|
||
class User extends Authenticatable | ||
{ | ||
use HasFactory; | ||
|
||
protected $guarded = []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
<?php | ||
|
||
use Coderflex\FilamentTurnstile\Tests\Fixtures\Login; | ||
use Coderflex\FilamentTurnstile\Tests\Fixtures\Register; | ||
|
||
use function Pest\Livewire\livewire; | ||
|
||
it('has captcha field', function () { | ||
it('can render login page', function () { | ||
livewire(Login::class) | ||
->assertOk(); | ||
}); | ||
|
||
it('can render register page', function () { | ||
livewire(Register::class) | ||
->assertOk(); | ||
}); | ||
|
||
test('login page has captcha field', function () { | ||
livewire(Login::class) | ||
->assertFormFieldExists('cf-captcha'); | ||
}); | ||
|
||
test('register page has captcha field', function () { | ||
livewire(Register::class) | ||
->assertFormFieldExists('cf-captcha'); | ||
}); |