Tests: assertActionDoesNotExist failing for DeleteAction

I have a simple test to check if my DeleteActions are being hidden appropriately for users that don't have the permission. This works fine in the app, but in my tests the assertions don't seem to behave the same way. My test is as follows (assuming I have a user with the relevant lack of permissions):
test('delete resource hidden', function () {
Livewire::actingAs($this->user)
->test(EditThing::class, ['record' => $this->thing->getRouteKey()])
->assertActionDoesNotExist(DeleteAction::class);
});
test('delete resource hidden', function () {
Livewire::actingAs($this->user)
->test(EditThing::class, ['record' => $this->thing->getRouteKey()])
->assertActionDoesNotExist(DeleteAction::class);
});
Assuming the ThingPolicy returns false for delete/deleteAny (which it does), why does the test always fail? To prove my point, I changed it to assertActionExists and it passes. I've tried to dive in to see where DeleteAction might check the relevant model policy but I can't find it.
0 Replies
No replies yetBe the first to reply to this messageJoin