F
Filament2y ago
dyo

testing create data in modal form

How can i test create data in modal form?
2 Replies
Kiran Timsina
Kiran Timsina2y ago
use --simple when you're creating resource. Eg. php artisan make:filament-resource UserResource --simple This is well documented in the first section of the docs.
sumardi
sumardi2y ago
use function Pest\Livewire\livewire;

it('can create posts', function () {
$post = Post::factory()->make();
livewire(ManagePosts::class)
->callPageAction('create', $post)
->assertHasNoPageActionErrors();
$this->assertDatabaseHas('posts', $post->only('name'));
});
use function Pest\Livewire\livewire;

it('can create posts', function () {
$post = Post::factory()->make();
livewire(ManagePosts::class)
->callPageAction('create', $post)
->assertHasNoPageActionErrors();
$this->assertDatabaseHas('posts', $post->only('name'));
});
Want results from more Discord servers?
Add your server