groenewege
groenewege
FFilament
Created by groenewege on 9/12/2023 in #❓┊help
How to test with multi-tenancy ?
When I want to test a create form on a multi-tenant aware panel, I get an error because the index route is missing the tenant parameter. I think this is the index route used by the "cancel" button. How do I inject the correct tenant in my test to prevent this error ? Here is my code :
test('superadmin can create admin', function () {
$this->signInAsSuperAdmin();
livewire(CreateSuperadmin::class)
->fillForm([
'name' => 'New Admin',
'email' => '[email protected]',
'password' => 'password',
])
->call('create')
->assertHasNoFormErrors();

$this->assertDatabaseHas(User::class, [
'name' => 'New Admin',
'email' => '[email protected]',
]);
});
test('superadmin can create admin', function () {
$this->signInAsSuperAdmin();
livewire(CreateSuperadmin::class)
->fillForm([
'name' => 'New Admin',
'email' => '[email protected]',
'password' => 'password',
])
->call('create')
->assertHasNoFormErrors();

$this->assertDatabaseHas(User::class, [
'name' => 'New Admin',
'email' => '[email protected]',
]);
});
Although it is the create page, I get the following error : Missing required parameter for [Route: filament.admin.resources.superadmin.index]
5 replies