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] allow 'assertJsonMissingValidationErrors' to be called without an argument #27176

Merged
merged 2 commits into from
Jan 16, 2019

Conversation

SjorsO
Copy link
Contributor

@SjorsO SjorsO commented Jan 15, 2019

This PR is a different implementation of #27172

This PR makes calling assertJsonMissingValidationErrors without an argument behave the same as as assertSessionHasNoErrors() (but it works for Json responses, since they don't store their errors in session).

Example:

$this->post(route('api.users.store'), $data)
    ->assertJsonMissingValidationErrors()
    ->assertStatus(201);

If this test has validation errors, it will print them to the console. If you would write the same test without the assertJsonMissingValidationErrors(), and then you get validation errors, the test will only print an unhelpful "expected status 201 but received 422".

@taylorotwell taylorotwell merged commit 990d867 into laravel:5.7 Jan 16, 2019
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.

2 participants