misuse of assertOnlyInvalid
could make tests passable
#55510
Labels
8000
assertOnlyInvalid
could make tests passable
#55510
Laravel Version
12.9.1
PHP Version
8.4
Database Driver & Version
No response
Description
Context: In my tests, I wanted to replace all my
assertInvalid
assertions byassertOnlyInvalid
then specify validation messages so I played around with parameters and tried to see if I could get away with doingassertOnlyInvalid('field', __('message'))
instead of passing an array.But I found the following a bit weird:
I know this is not the proper way to use this method but that test still passes. In this example, the anomaly is pretty obvious (w/ typos and random letters) but let's say we're an innocent dev and tried the following:
Obviously, there's no validation message with this key.
Since the test is passing and it looks okay to our eyes, it would pass by our radar.
Steps To Reproduce
assertSessionHasErrors
and replace it withassertOnlyInvalid
The text was updated successfully, but these errors were encountered: