Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

misuse of assertOnlyInvalid could make tests passable #55510

Copy link
Copy link
Closed
@mondesirm

Description

@mondesirm
Issue body actions

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 by assertOnlyInvalid then specify validation messages so I played around with parameters and tried to see if I could get away with doing assertOnlyInvalid('field', __('message')) instead of passing an array.

But I found the following a bit weird:

Image

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:

Image

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

  • Install any Starter Kit, I used the React one here.
  • Pick any test with assertSessionHasErrors and replace it with assertOnlyInvalid
  • Pass several arguments to it (do not use an array)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.