-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
test: fix forgetting to restore DBDebug value #6115
Conversation
All tests failed except MySQL. 😅
The failures show changing the behavior according to the DBDebug value is bad practice. Now in the development environment CI throws Exceptions when DB errors occur, |
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.
Wow I had no idea we did this in so many cases. Very good consolidation.
Something I would like to see in a future version is a way to "schedule" tear-down actions better - so something that knows it will need to be undone can go ahead and put that in place. It would something akin to this:
protected function enableDBDebug(): void
{
$this->setPrivateProperty($this->db, 'DBDebug', true);
$this->tearDownMethods[] = 'disableDBDebug`;
}
This is pretty bad behavior. Does DBDebug control anything else? Or is it just error handling? |
Probably major behavior change is throwing a Exception or returning false. |
For sure. I favor exceptions more than most of the team, so take it with a grain of salt but it seems to me anytime you "return false" to indicate failure and have a hidden error log that should have been an exception. |
I think this should be changed to always throw an exception on this matter. Since it is a BC, I think it needs to be configurable for exception mode and false mode. |
What about something like |
Yes, something like that. |
Description
disableDBDebug()
andenableDBDebug()
inDatabaseTestTrait
enableDBDebug()
Related #6113
Checklist: