© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
8 replies
ShawnVeltman

Pest Testing Repeater (extra value added in tests)

Hi all,

I'm hoping somebody can help me understand where I'm going wrong.

I've set up a repeater action

return CreateAction::make('create_content')
            ...
            ->form([
                Section::make('Content')
                    ->description('Add your content ')
                    ->schema([
                        Repeater::make('articles')
                            ->label('')
                            ->addActionLabel('Add More Content')
                            ->schema([
                                TextArea::make('body')
                                    ->label('')
                                    ->required(),
                            ]),
                    ]),
            ])->using(function (array $data, string $model): Model {
                // I check my $data['articles'] here
            });
return CreateAction::make('create_content')
            ...
            ->form([
                Section::make('Content')
                    ->description('Add your content ')
                    ->schema([
                        Repeater::make('articles')
                            ->label('')
                            ->addActionLabel('Add More Content')
                            ->schema([
                                TextArea::make('body')
                                    ->label('')
                                    ->required(),
                            ]),
                    ]),
            ])->using(function (array $data, string $model): Model {
                // I check my $data['articles'] here
            });


I'm trying to test it as such:

livewire(MyComponent::class)
        ->callTableAction('create_content', data: ['articles' => [
            ['body' => 'huh?'],
            ['body' => 'woah'],
            ['body' => 'cool'],
        ],
        ]);
livewire(MyComponent::class)
        ->callTableAction('create_content', data: ['articles' => [
            ['body' => 'huh?'],
            ['body' => 'woah'],
            ['body' => 'cool'],
        ],
        ]);


However, when I run the test in debug, the $data['articles'] variable has 4 entries - 1 null, and then the 3 I've specified in my test.

Normally it wouldn't be a problem, I can just filter out the null value, but when I add in a ->required() to the textfield in the repeater, the test doesn't work (due to the null value, I'm assuming).

Has anybody else experienced this, and can you point me to what I'm doing wrong?

Thanks so much!
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Import PEST Tests
FilamentFFilament / ❓┊help
2y ago
Create pest tests
FilamentFFilament / ❓┊help
3y ago
testing panels in pest?
FilamentFFilament / ❓┊help
3y ago
testing uploads with Pest
FilamentFFilament / ❓┊help
3y ago