|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Tests\Components; |
| 6 | + |
| 7 | +use ARKEcosystem\Fortify\Components\RegisterForm; |
| 8 | +use Faker\Provider\Uuid; |
| 9 | +use Illuminate\Database\Eloquent\Model; |
| 10 | +use Illuminate\Support\Facades\Config; |
| 11 | +use Illuminate\Support\Facades\Route; |
| 12 | +use Livewire\Livewire; |
| 13 | +use Spatie\MediaLibrary\MediaCollections\Models\Concerns\HasUuid; |
| 14 | + |
| 15 | +it('can interact with the form', function () { |
| 16 | + Config::set('fortify.models.invitation', RegisterFormTest::class); |
| 17 | + Route::get('terms-of-service', function () { |
| 18 | + return view(''); |
| 19 | + })->name('terms-of-service'); |
| 20 | + Route::get('privacy-policy', function () { |
| 21 | + return view(''); |
| 22 | + })->name('privacy-policy'); |
| 23 | + Route::get('notification-settings', function () { |
| 24 | + return view(''); |
| 25 | + })->name('notification-settings'); |
| 26 | + |
| 27 | + $invitationUuid = Uuid::uuid(); |
| 28 | + |
| 29 | + Livewire::withQueryParams(['invitation' => $invitationUuid]) |
| 30 | + ->test(RegisterForm::class) |
| 31 | + ->set('state.name', 'John Doe') |
| 32 | + ->set('state.username', 'jdoe') |
| 33 | + ->set('state.email', 'jdoe@example.org') |
| 34 | + ->set('state.email', 'jdoe@example.org') |
| 35 | + ->assertViewIs('ark-fortify::auth.register-form') |
| 36 | + ->assertViewHas('invitation'); |
| 37 | +}); |
| 38 | + |
| 39 | +/** |
| 40 | + * @coversNothing |
| 41 | + */ |
| 42 | +class RegisterFormTest extends Model |
| 43 | +{ |
| 44 | + use HasUuid; |
| 45 | + |
| 46 | + public static function findByUuid(string $uuid): ?Model |
| 47 | + { |
| 48 | + return new self(); |
| 49 | + } |
| 50 | +} |
0 commit comments