-
Notifications
You must be signed in to change notification settings - Fork 153
Fix mocking of interface which extend Throwable #402
Fix mocking of interface which extend Throwable #402
Conversation
ed73d7e
to
5c4a58f
Compare
Issue reproduced in https://travis-ci.org/sebastianbergmann/phpunit-mock-objects/jobs/338651530 |
…ion and Throwable
Codecov Report
@@ Coverage Diff @@
## master #402 +/- ##
============================================
+ Coverage 72.77% 72.95% +0.17%
- Complexity 436 438 +2
============================================
Files 27 27
Lines 1227 1235 +8
============================================
+ Hits 893 901 +8
Misses 334 334
Continue to review full report at Codecov.
|
… merged and released
… merged and released
… merged and released
… merged and released
… merged and released
@sebastianbergmann can I drag your attention to this PR? ;-) THX a lot! |
That being said, can you elaborate why you implement |
We are trying to mock dbal's Doctrine\DBAL\Driver\DriverException which is an interface. See owncloud/core@1a5e980 - in the workaround I switched to Doctrine\DBAL\Driver\AbstractDriverException |
FYI: Back in 2.5 the interface did not inherit from \Throwable - https://github.com/doctrine/dbal/blob/2.5/lib/Doctrine/DBAL/Driver/DriverException.php#L32 |
Throwable is not implemented in userland, it is just implemented as part of interface SomeException extends Throwable // correct semantics, otherwise it can't be an exception anyway
{
} class MyException extends OutOfBoundsException implements SomeException
{
} The change is just semantic. From my PoV, it makes no sense to mock a What PHPUnit would have to do (if mocking is needed) is extending |
Ah, I see that this patch already does that :) Also, re-thinking about the "makes no sense to mock a |
Thank you for the explanation, @Ocramius. |
And thank you, @DeepDiver1975, for the patch! :-) |
my pleasure - happy to contribute back to a tool we use for years! |
… merged and released
… merged and released
… merged and released
fixes sebastianbergmann/phpunit#2995