Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.7] Check that a specific error is missing #25949

Merged
merged 1 commit into from
Oct 8, 2018

Conversation

shadoWalker89
Copy link
Contributor

This will allow to check that a specific field has no error in tests.
My use case is the following.

I have a form with these fields

Label, With uploads, Upload label, Upload deadline

The Upload label and Upload deadline fields are only required when the With uploads checkbox is checked.

I have a test where i check that the required field validation is correct.

I'm checking that when the With uploads is not checked i should have no errors for Upload label, Upload deadline

        $response->assertSessionHasErrors(['label']);
        $response->assertSessionHasNoErrors(['presentation_label', 'presentation_upload_deadline']);

Of course this update does not introduce any breaking changes, if the $keys argument is empty we will just assert that there is no errors at all.

Also, i checked the FoundationTestResponseTest and found no existing tests about session error assertions. If you would like i can make another PR to add tests for all session assertions.

@taylorotwell
Copy link
Member

Made this a separate method. Made it match corresponding method.

@taylorotwell taylorotwell merged commit 5c4ee8e into laravel:5.7 Oct 8, 2018
@shadoWalker89 shadoWalker89 deleted the patch-3 branch October 10, 2018 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants