-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Refactor FK exception tests #3800
Conversation
Note: the SQL Server failure on Travis seems unrelated to this change:
Should I force push the previous commit to restart the build? |
|
||
throw $exception; | ||
} catch (Throwable $exception) { | ||
} finally { | ||
$this->tearDownForeignKeyConstraintViolationExceptionTest(); |
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.
Would it make more sense to extract this test to a separate class and let PHPUnit take care of calling it? Or just make this routine part of the shared teardown? Calling it manually and having flow control logic in a test still smells.
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.
It does smell, but smells less than before! ;-) That's a good point, though. Moved to their own class with proper setUp()/tearDown()
in da3a944.
A rebase is probably needed before this can be merged. |
Rebased & squashed! |
Thanks @BenMorel! |
Summary
Several tests can be greatly simplified by delegating the tear-down tasks tofinally {}
, instead of catching and re-throwing exceptions.This works fine withexpectException()
, too.Moved FK exception tests to their own class with proper
setUp()
/tearDown()
.