-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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.8] Teardown test suite after using fail() method #29267
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well this seems ok to me :)
I had not seen your new changes with the addition of the Well I guess this will work since we are no longer preventing other callbacks from running. Well done :) |
Changes will still need to be replicated in orchestral/testbench-core#25 though. Do you want me to do it or will you? |
What problem is this solving? Thanks! |
@taylorotwell This one #29246 Steps to reproduce can be found at the bottom of the issue (#29246 (comment)) This bug is kind of hard to explain but I'll do my best :) Currently if you use That is because This exception breaks the flow of execution of the /**
* Clean up the testing environment before the next test.
*
* @return void
*/
protected function tearDown(): void
{
if ($this->app) {
foreach ($this->beforeApplicationDestroyedCallbacks as $callback) {
call_user_func($callback); // <------- The exception is thrown here.
// Everything below this line is thus never executed
}
$this->app->flush();
$this->app = null;
}
// ... Code here won't get executed as-well
} I can give more details about the bug if you want but I think this will give you enough informations. |
This PR has 2 changes:
beforeApplicationDestroyedCallbacks
are called by catching any exceptions thrown during one of the callbacks.once()
method so mockery doesn't run verifications on the count, this will allow our mechanism to handle failure using$this->fail()
;