© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•15mo ago•
26 replies
Jamie Cee

illegal offset type in tests

I have many of my tests fail with the same error, and not sure why.

As an example test that is failing, its complaining about the ->test line
    public function test_missing_fields_when_creating_user(): void
    {
        $this->tempUser->assignRole(RoleConstants::SUPER_ADMIN);

        Livewire::actingAs($this->tempUser)
            ->test(UserResource\Pages\CreateUser::class)
            ->call('create')
            ->assertHasErrors(['data.name', 'data.email', 'data.password', 'data.password_confirmation']);

        $this->tempUser->removeRole(RoleConstants::SUPER_ADMIN);
    }
    public function test_missing_fields_when_creating_user(): void
    {
        $this->tempUser->assignRole(RoleConstants::SUPER_ADMIN);

        Livewire::actingAs($this->tempUser)
            ->test(UserResource\Pages\CreateUser::class)
            ->call('create')
            ->assertHasErrors(['data.name', 'data.email', 'data.password', 'data.password_confirmation']);

        $this->tempUser->removeRole(RoleConstants::SUPER_ADMIN);
    }
image.png
Solution
I Finally found it.

So basically where im creating the temp users, I have to cast the uuid as a string when creating
        $user->id = (string) Str::uuid();
        $user->id = (string) Str::uuid();


Else it was detecting as a LazyLoadFromUuid or some named object
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Htmlable label - illegal offset type
FilamentFFilament / ❓┊help
2y ago
Illegal offset error upon adding data
FilamentFFilament / ❓┊help
2y ago
Class "..." not found in tests
FilamentFFilament / ❓┊help
8mo ago
Error calling table actions in tests
FilamentFFilament / ❓┊help
8mo ago