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

Projects
None yet
3 participants
@shadoWalker89
Contributor

shadoWalker89 commented Oct 5, 2018

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

This comment has been minimized.

Show comment
Hide comment
@taylorotwell

taylorotwell Oct 8, 2018

Member

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

Member

taylorotwell commented Oct 8, 2018

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

@taylorotwell taylorotwell merged commit 5c4ee8e into laravel:5.7 Oct 8, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@shadoWalker89 shadoWalker89 deleted the shadoWalker89:patch-3 branch Oct 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment