File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
resources/views/resources/pages/create
src/TestRenderers/Resources/Pages/Create Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ @php use Illuminate\Support\Facades\ Log ; @endphp
2+ it('can create a record', function (): void {
3+ $record = {{ $getResourceModel () } } ::factory()->make();
4+
5+ livewire({{ $getPageClass (' create' ) } } ::class)
6+ ->fillForm([
7+ @foreach ($getResourceFormFields () as $key => $field )
8+ '{{ $key } } ' => $record->{{ $key } } ,
9+ @endforeach
10+ ])
11+ ->call('create')
12+ ->assertNotified();
13+
14+ $this->assertDatabaseHas({{ $getResourceModel () } } ::class, [
15+ @foreach ($getResourceFormFields () as $key => $field )
16+ '{{ $key } } ' => $record->{{ $key } } ,
17+ @endforeach
18+ ]);
19+ });
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace CodeWithDennis \FilamentTests \TestRenderers \Resources \Pages \Create ;
4+
5+ use CodeWithDennis \FilamentTests \TestRenderers \BaseTest ;
6+
7+ class CanCreateRecordTest extends BaseTest
8+ {
9+ public ?string $ view = 'filament-tests::resources.pages.create.can-create-record ' ;
10+
11+ public function getShouldRender (): bool
12+ {
13+ return $ this ->hasPage ('create ' );
14+ }
15+ }
You can’t perform that action at this time.
0 commit comments