Jonathan G
Jonathan G
FFilament
Created by jaocero on 11/2/2023 in #❓┊help
How to test a simple resource CRUD functionality?
Hi ! This is my code for testing simple resource :
it('can create a new origin', function(){
$newData = AccountOrigin::factory()->make();
livewire(AccountOriginResource\Pages\ManageAccountOrigins::class)
->mountAction('create')
->setActionData([
'name' => $newData->name,
'description' => $newData->description,
])
->callMountedAction();

$this->assertDatabaseHas(AccountOrigin::class, [
'name' => $newData->name,
'description' => $newData->description,
]);
});
it('can create a new origin', function(){
$newData = AccountOrigin::factory()->make();
livewire(AccountOriginResource\Pages\ManageAccountOrigins::class)
->mountAction('create')
->setActionData([
'name' => $newData->name,
'description' => $newData->description,
])
->callMountedAction();

$this->assertDatabaseHas(AccountOrigin::class, [
'name' => $newData->name,
'description' => $newData->description,
]);
});
6 replies