How to add coverage for mutated RemoveMethodCall? #1272
Replies: 3 comments
-
can you share the test? |
Beta Was this translation helpful? Give feedback.
0 replies
-
normally you had something like this I guess:
And then you need to add a second case I suppose:
But in this case you need to relax your code from this:
to this:
Does that make sense? |
Beta Was this translation helpful? Give feedback.
0 replies
-
It does make sense... thanks for your answer, I will look into this and see if I can do it this way. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I really like the mutation-testing in v3, but I have a situation. Consider the following pseudo-code:
To make sure
bar()
cannot returnnull
I added an assertion (phpstan likes it better this way too). For me this is where assertions shine:$bar
should always be a string in this case.Now when I run a mutation test, pest removes the assertion and claims the line is not covered (which is true). However, there is no way to test this. Now I could add
// @pest-mutate-ignore
but then I have to add it to all assertions. And the assertion is not wrong here, it's just to make sure the code acts the way I expect it to do (for instance if the vendor changes the api offoo()
).Any suggestions, or am I missing something obvious here?
Beta Was this translation helpful? Give feedback.
All reactions