© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•14mo ago•
3 replies
MaxieWright

Failing test when calling testing a table action

I encounter a failing test when testing a custom table action. Specifically, the test fails on the final assertion when I call the update method on a model before invoking the callTableAction method.

Problem:
The test fails on the final expectation, but the table action works correctly in the browser. Also, I have other tests with custom table actions that pass once nothing is called before invoking the callTableAction.

Can someone help me understand why the test is failing?

php 

it('extends the expiry date of an expired invitation', function () {

    $this->invitation->update([
        'expires_at' => now()->subDays(1),
        'status' => InvitationStatus::Expired,
    ]);

    $this->invitation->refresh();

    expect($this->invitation->expiryDatePassed())->toBeTrue()
        ->and($this->invitation->status)->toBe(InvitationStatus::Expired);

    Livewire::test(ListInvitations::class)
        ->callTableAction('extendExpiryDate', $this->invitation)
        ->assertHasNoActionErrors();

    $this->invitation->refresh();

    // Fails Here 
    expect($this->invitation->expires_at->isFuture())->toBeTrue()
        ->and($this->invitation->status)->toBe(InvitationStatus::Pending);

}); 
php 

it('extends the expiry date of an expired invitation', function () {

    $this->invitation->update([
        'expires_at' => now()->subDays(1),
        'status' => InvitationStatus::Expired,
    ]);

    $this->invitation->refresh();

    expect($this->invitation->expiryDatePassed())->toBeTrue()
        ->and($this->invitation->status)->toBe(InvitationStatus::Expired);

    Livewire::test(ListInvitations::class)
        ->callTableAction('extendExpiryDate', $this->invitation)
        ->assertHasNoActionErrors();

    $this->invitation->refresh();

    // Fails Here 
    expect($this->invitation->expires_at->isFuture())->toBeTrue()
        ->and($this->invitation->status)->toBe(InvitationStatus::Pending);

}); 
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

testing table action
FilamentFFilament / ❓┊help
2y ago
Table action testing
FilamentFFilament / ❓┊help
3y ago
"reorderRecords" action not found when testing a reorderable table
FilamentFFilament / ❓┊help
8mo ago
Calling a javascript function from a table action
FilamentFFilament / ❓┊help
3y ago