© 2026 Hedgehog Software, LLC

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

How to test a Table header action on a Relationship Manager?

I have the following test:
/** @test */
public function can_assign_users_to_job_on_view_page()
{
    $admin = User::factory()->create();
    $job = Job::factory()->create();
    $employee = User::factory()->create();

    Livewire::actingAs($admin)
        ->test(UsersRelationManager::class, ['ownerRecord' => $job])
        ->assertSuccessful()
        ->callPageAction(AttachAction::class, [
            'recordId' => $employee->id,
            'task' => Job::EXCAVATE,
        ]);

    $this->assertDatabaseHas('job_user', [
        'job_id' => $job->id,
        'user_id' => $employee->id,
        'task' => Job::EXCAVATE,
    ]);
}
/** @test */
public function can_assign_users_to_job_on_view_page()
{
    $admin = User::factory()->create();
    $job = Job::factory()->create();
    $employee = User::factory()->create();

    Livewire::actingAs($admin)
        ->test(UsersRelationManager::class, ['ownerRecord' => $job])
        ->assertSuccessful()
        ->callPageAction(AttachAction::class, [
            'recordId' => $employee->id,
            'task' => Job::EXCAVATE,
        ]);

    $this->assertDatabaseHas('job_user', [
        'job_id' => $job->id,
        'user_id' => $employee->id,
        'task' => Job::EXCAVATE,
    ]);
}


I don't think
callPageAction
callPageAction
is correct since if I use it, I get the following error:
UsersRelationManager::getCachedAction does not exist.
UsersRelationManager::getCachedAction does not exist.


If I use
callTableAction
callTableAction
I get the following error:
RelationManager::getTableRecord(): Argument #1 ($key) must be of type ?string, array given,
RelationManager::getTableRecord(): Argument #1 ($key) must be of type ?string, array given,


Which makes sense, but what should I use?
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

Call table header action during test
FilamentFFilament / ❓┊help
16mo ago
how to refresh relationship manager table?
FilamentFFilament / ❓┊help
3y ago
Testing Table Header action in relation manager?
FilamentFFilament / ❓┊help
2y ago
table action to open the relationship manager in a modal?
FilamentFFilament / ❓┊help
2y ago