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
Prevent multiple migrate:rollback on beforeApplicationDestroyed #168
Comments
If you have a solution for this, feel free to submit a PR. |
Tried to fix this but no luck still. Will try to find the way to solve this later this week because it's blocking the upgrade of some of my packages. |
Could you do me a favour and try with the following changes: /**
* Register a callback to be run before the application is destroyed.
*
* @param callable $callback
*
* @return void
*/
protected function beforeApplicationDestroyed(callable $callback)
{
array_unshift($this->beforeApplicationDestroyedCallbacks, $callback);
} |
@crynobone It works! I haven't checked if database migrations are rolled back correctly between tests yet, but no errors with this fix. |
Should I make a PR for it or you will do it? |
That's is good news, use that first on your projects and feel free to submit a PR once you're confident with the fix. To confirm, the following tests in the same class shouldn't have any data (created from factory) from the previous tests. |
@crynobone Thanks for a such a quick resolution as always! |
Everything works great right? can you make the PR to branch |
@crynobone Yes. It works well for my case. Why to Edit: Ah... I see this behavior is the same in 3.1 too. |
If
loadMigrationsFrom
method will be called multiple times - test bench will crash on the rollback. Because it's registering this action twice. First rollback will be successful and the second one will crash an app.Use case:
The text was updated successfully, but these errors were encountered: