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] Fix assertSessionDoesntHaveErrors() when there is no errors #27145

Merged
merged 1 commit into from Jan 14, 2019

Conversation

Projects
None yet
3 participants
@shadoWalker89
Copy link
Contributor

shadoWalker89 commented Jan 12, 2019

When the response has no errors at all and we do

$response->assertSessionDoesntHaveErrors('can_be_invited_as_reviewer');

A php error will occur
Error : Call to a member function getBag() on null F:\projects\quick-conference\src\quick-conference\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestResponse.php:904

The reason is that the assertion method is not taking into consideration someone checking that a specific error is missing when there is no errors at all.

Having this in a test

$response->assertSessionDoesntHaveErrors('can_be_invited_as_reviewer');

intead of this

$response->assertSessionDoesntHaveErrors();

makes it clearer that the test is checking that the can_be_invited_as_reviewer is missing.

Edit: btw the assertJsonMissingValidationErrors() allows for the behavior that the PR is adding, this will make things more consistent.

@taylorotwell

This comment has been minimized.

Copy link
Member

taylorotwell commented Jan 12, 2019

Might be better to actually make an assertion? Even assertTrue(true) just so PHPUnit doesn't confusingly complain about no assertions being made in a test that only calls this method.

@shadoWalker89 shadoWalker89 force-pushed the shadoWalker89:patch-1 branch from 2230180 to d0bf3fd Jan 12, 2019

@shadoWalker89

This comment has been minimized.

Copy link
Contributor Author

shadoWalker89 commented Jan 12, 2019

You are totally right. Change applied.

@shadoWalker89 shadoWalker89 force-pushed the shadoWalker89:patch-1 branch from d0bf3fd to 09c5478 Jan 14, 2019

@shadoWalker89 shadoWalker89 force-pushed the shadoWalker89:patch-1 branch from 09c5478 to a621f8a Jan 14, 2019

@taylorotwell taylorotwell merged commit 87ca267 into laravel:5.7 Jan 14, 2019

2 checks passed

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

@shadoWalker89 shadoWalker89 deleted the shadoWalker89:patch-1 branch Jan 14, 2019

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