Testing Infolists headerAction
How do we test infolist headerAction which is on an ViewPage with infolist
Solution:Jump to solution
define a key in the section,
->key('sectionStatus')
Then, you can use
```php
->assertInfolistActionExists('sectionStatus','updateStatus')...4 Replies
what code are you using?
return $infolist
->schema([
Section::make('DETAILS AND STATUS')
->headerActions(
[
Action::make('updateStatus')
->fillForm(fn (Program $record): array => [
'ProgramStatus' => $record->status,
])
->form([
Select::make('ProgramStats')
->label('Program Status')
->options(fn() => ProgramStatus::class)
->required(),
])
->action(function (array $data, Program $record): void {
$record->status = $data['ProgramStatus'] ;
$record->save();
}),
I wanted to test this updateStatus action on a section header of infolist.
Solution
define a key in the section,
->key('sectionStatus')
Then, you can use
Thanks for that quick reply... testing worked.. Also it seems that instead of 'key' we can also use 'id'. I believe both serve the same purpose