This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 153
Do not mock method which returns final class #386
Merged
sebastianbergmann
merged 1 commit into
sebastianbergmann:master
from
kubawerlos:do-not-mock-method-which-has-final-class-as-return-type
Nov 2, 2017
Merged
Do not mock method which returns final class #386
sebastianbergmann
merged 1 commit into
sebastianbergmann:master
from
kubawerlos:do-not-mock-method-which-has-final-class-as-return-type
Nov 2, 2017
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #386 +/- ##
============================================
+ Coverage 71.73% 71.82% +0.08%
- Complexity 438 442 +4
============================================
Files 27 27
Lines 1256 1260 +4
============================================
+ Hits 901 905 +4
Misses 355 355
Continue to review full report at Codecov.
|
Thanks! |
lcobucci
added a commit
to lcobucci/phpunit-mock-objects
that referenced
this pull request
Nov 21, 2017
Because of the validation added recently that checks if the returned class is final, we can no longer mock methods that uses `\Generator` or `\Closure` as return type. I thought on verying that in a different way but I can't think of another possible scenario for this kind of issue. Reference: sebastianbergmann#386
sebastianbergmann
pushed a commit
that referenced
this pull request
Nov 22, 2017
Because of the validation added recently that checks if the returned class is final, we can no longer mock methods that uses `\Generator` or `\Closure` as return type. I thought on verying that in a different way but I can't think of another possible scenario for this kind of issue. Reference: #386
You can actually mock the method when it returns the final class optionally, like |
@pr0nbaer Correct. That is now possible as of a8984cd. |
axiac
pushed a commit
to axiac/phpunit
that referenced
this pull request
May 8, 2018
Because of the validation added recently that checks if the returned class is final, we can no longer mock methods that uses `\Generator` or `\Closure` as return type. I thought on verying that in a different way but I can't think of another possible scenario for this kind of issue. Reference: sebastianbergmann/phpunit-mock-objects#386
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently for a class
Example
:when trying to mock:
an error occurs: