paamayim
paamayim
FFilament
Created by paamayim on 12/24/2023 in #❓┊help
Is it possible to test a multiple select form?
Test body:
it('can create', function () {
$tags = Tag::factory()->count(6)->create();
$newData = Post::factory()->make();

livewire(PostResource\Pages\CreatePost::class)
->fillForm([
'tags' => $tags->keys(),
'title' => $newData->title,
// other fields ...
])
->call('create')

// $this->assertDatabaseHas(...);
});
it('can create', function () {
$tags = Tag::factory()->count(6)->create();
$newData = Post::factory()->make();

livewire(PostResource\Pages\CreatePost::class)
->fillForm([
'tags' => $tags->keys(),
'title' => $newData->title,
// other fields ...
])
->call('create')

// $this->assertDatabaseHas(...);
});
I have relation like https://laravel.com/docs/10.x/eloquent-relationships#many-to-many-polymorphic-relations My filament form body:
Forms\Components\Select::make('tags')
->relationship('tags', 'name')
->multiple()
->preload()
Forms\Components\Select::make('tags')
->relationship('tags', 'name')
->multiple()
->preload()
When I try to run the test, I get the error: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
3 replies