© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
sfrigzs

Help with action tests

I can't figure out what's wrong with my code. For my tags resource, I have the following data editing test, which works very well.

test('Edit tag', function () {

    $tag = Tag::factory()->create();

    livewire(ListTags::class)
        ->callTableAction(EditAction::class, $tag, data: [
            'title' => $title = 'Editing tag',
        ])
        ->assertHasNoTableActionErrors();

    expect($tag->refresh())->title->toBe($title);

});
test('Edit tag', function () {

    $tag = Tag::factory()->create();

    livewire(ListTags::class)
        ->callTableAction(EditAction::class, $tag, data: [
            'title' => $title = 'Editing tag',
        ])
        ->assertHasNoTableActionErrors();

    expect($tag->refresh())->title->toBe($title);

});


I have the following similar code for my tasks resource, but this code doesn't work.

test('Edit simple task', function () {

    $task = Task::factory()->create();

    livewire(ListTasks::class)
        ->callTableAction(EditAction::class, $task, data: [
            'title' => $title = 'Editing task',
        ])
        ->assertHasNoTableActionErrors();

    expect($task->refresh())->title->toBe($title);

});
test('Edit simple task', function () {

    $task = Task::factory()->create();

    livewire(ListTasks::class)
        ->callTableAction(EditAction::class, $task, data: [
            'title' => $title = 'Editing task',
        ])
        ->assertHasNoTableActionErrors();

    expect($task->refresh())->title->toBe($title);

});


It's as if the persistence in the database doesn't happen for tasks. It also doesn't work for deleting records. I've been stuck on this for 3 days. Could someone help me?

Failed asserting that two strings are identical.
Expected :'Editing task'
Actual   :'Et omnis corrupti hic.'
Failed asserting that two strings are identical.
Expected :'Editing task'
Actual   :'Et omnis corrupti hic.'
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

hint action tests
FilamentFFilament / ❓┊help
3y ago
Help with action modal
FilamentFFilament / ❓┊help
14mo ago
Help with table action test
FilamentFFilament / ❓┊help
2y ago
Action with AlpineJS
FilamentFFilament / ❓┊help
3y ago