marco.ferreira
marco.ferreira
FFilament
Created by marco.ferreira on 8/14/2023 in #❓┊help
Cannot test a RelationManager
I'm trying to test a relation manager (to make sure some records are visible). As per documentation, I do a
livewire(EmployeesRelationManager::class)
livewire(EmployeesRelationManager::class)
and it worked correctly on v2. Now, on v3, it fails with the error
Filament\Resources\RelationManagers\RelationManager::getTitle(): Argument #2 ($pageClass) must be of type string, null given, called in .../vendor/filament/filament/src/Resources/RelationManagers/RelationManager.php on line 476
Filament\Resources\RelationManagers\RelationManager::getTitle(): Argument #2 ($pageClass) must be of type string, null given, called in .../vendor/filament/filament/src/Resources/RelationManagers/RelationManager.php on line 476
. I can't figure out how to solve or what I have to do since my EmployeesRelationManager is a simple RelationManager that only implements the form() and table() functions... Has this happened to anyone? How can I solve it?
3 replies
FFilament
Created by marco.ferreira on 8/11/2023 in #❓┊help
Problem in the format_money helper
It seems there is a problem in the format_money helper. If we specify a divider (as in a TextoColumn::make(...)->money("EUR", 100) ), it will perform a bcdiv without any precision specified. So, if we have a monetary value in cents, it will cut the cents part. Or am I missing anything?
6 replies
FFilament
Created by marco.ferreira on 3/14/2023 in #❓┊help
Testing a confirming action
I'm trying to make a test that ensures that if an action that requires confirmation is called and the user does not confirm the operation then it is not called. For simplicity sake, imagine it is a table's delete action. What can I do to simulate the user dismissing the dialog instead of submiting it? Here's what I have so far:
$page = livewire(MyResourceListPage::class)
->assertCountTableRecords(1)
->assertTableActionExists('delete')
->mountTableAction('delete', $businessArea)
->assertTableActionHalted('delete');

// Now I would dismiss the confirmation dialog
//How??

// And make sure the record was not deleted
expect(MyModel::query()->where('id', $knownId)->count())->toBe(1);
$page = livewire(MyResourceListPage::class)
->assertCountTableRecords(1)
->assertTableActionExists('delete')
->mountTableAction('delete', $businessArea)
->assertTableActionHalted('delete');

// Now I would dismiss the confirmation dialog
//How??

// And make sure the record was not deleted
expect(MyModel::query()->where('id', $knownId)->count())->toBe(1);
5 replies
FFilament
Created by marco.ferreira on 3/13/2023 in #❓┊help
Testing Modals
I'd like to create a simple unit test to check that if I call a Page Action, then a modal is shown with the form. For example, I want to test that when I call the CreateAction (on a simple ResourceManager) that the modal with the create form is shown and that it contains some fields. How can I do that?
3 replies