[5.8] Teardown test suite after using fail() method#29267
Conversation
paulhenri-l
left a comment
There was a problem hiding this comment.
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:
beforeApplicationDestroyedCallbacksare 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();