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
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
1 Reply
paamayim
paamayimOP12mo ago
Also it not working with simple many-to-many relationship
Want results from more Discord servers?
Add your server