-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Do not ignore constructor arguments based on type being mocked #3694
Do not ignore constructor arguments based on type being mocked #3694
Conversation
Codecov Report
@@ Coverage Diff @@
## 7.5 #3694 +/- ##
============================================
- Coverage 83.37% 83.36% -0.01%
+ Complexity 3647 3645 -2
============================================
Files 143 143
Lines 9713 9711 -2
============================================
- Hits 8098 8096 -2
Misses 1615 1615
Continue to review full report at Codecov.
|
1. Got rid of hard-coded exception mocks in favor of PHPUnit-generated ones. 2. Reworked AbstractDriverTest::testConvertsException() to use a data provider to make testing all types of exceptions independent. 3. Updated PHPUnit since the reworked code relies on sebastianbergmann/phpunit#3604 and sebastianbergmann/phpunit#3694.
1. Got rid of hard-coded exception mocks in favor of PHPUnit-generated ones. 2. Reworked AbstractDriverTest::testConvertsException() to use a data provider to make testing all types of exceptions independent. 3. Updated PHPUnit since the reworked code relies on sebastianbergmann/phpunit#3604 and sebastianbergmann/phpunit#3694.
Just curious: in what scenario does stubbing/mocking |
In doctrine/dbal, we have some logic of handling/generalizing driver exceptions based on their properties. We do not mock |
Can you point me to a test that does this? Thanks! |
See |
Currently, it is impossible to mock the message or code on a
Trowable
. On the one hand,getMessage()
andgetCode()
arefinal
inException
, on the other, the mock generator ignores constructor arguments if the type being mocked is an interface.The existing behavior doesn't seem correct because on the one hand, PHP currently allows passing more arguments than the method expects (including class constructors). On the other, if it stops doing so at some point later, it should be a test error, not the PHPUnit's call to ignore the arguments.