Cannot delete test
Hi
I wonder what's the easiest and most maintenable way of checking something cannot be deleted from a testing point of view. I mean, testing it is not possible from "bulking action", "table action", "page action" etc requires, imo, too much test code.
I would rather look for something unique, that would look like this:
I've been adviced to use a Laravel policy to implement it. Fair enough but it is not what's relevant here. For some reasons we might not want to use a policy, and the test should be as abstract as possible from the implementations. What I mean is I don't want to have a test on a policy, but rather a "Filament test" that is more close to the feature spec than the code itself
Thanks π if you have any information about this. Moved to a help post as it's not as simple as I though initially π
4 Replies
If you don't want to repeat those tests invidividually, you can create a method that does it for you
So I have to test all these tests, but hide the repetition in a method (in the end there is still one test, but it tests all of the delete then)?
What Dennis is saying is to create a single method or trait which you can then use in your tests that takes a single option, like resource and any additional params
Yes, and the method (or trait) checks that for resource given, let's say
FooResource
, checks it again "bulk action", "page action", and "table action" π€
I guess the signature could be something like
So that It can be used like so: