Skip to content
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

#3120 implemented TestCase#createStub() #3810

Merged
merged 10 commits into from Sep 6, 2019
Merged

#3120 implemented TestCase#createStub() #3810

merged 10 commits into from Sep 6, 2019

Conversation

Ocramius
Copy link
Sponsor Contributor

@Ocramius Ocramius commented Sep 6, 2019

Fixes #3120

In practice, a MockObject is also a Stub, so we are just aliasing methods, but it is also true that the type-checker now does the heavy lifting for us. If people use MockObject methods after being told explicitly that a Stub is returned, that's a type error downstream.

Auto-completion now restricts methods correctly, so we're good 👍

… false positive

The method `InvocationMocker#will()` is LSP-compliant with the parent
types, but a bug in psalm reports it as a false positive.

Ref: vimeo/psalm#2102
I was too eager in using an appropriate type declaration on `InvocationMocker`,
but that has to wait for newer PHP releases.
Once we have PHP 7.4, we can move these type declarations into the interface
signature again, but for now, the existing inheritance leads to a crash
on PHP < 7.4.
@codecov
Copy link

codecov bot commented Sep 6, 2019

Codecov Report

Merging #3810 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3810      +/-   ##
============================================
+ Coverage      82.5%   82.56%   +0.06%     
- Complexity     3834     3835       +1     
============================================
  Files           150      150              
  Lines         10146    10148       +2     
============================================
+ Hits           8371     8379       +8     
+ Misses         1775     1769       -6
Impacted Files Coverage Δ Complexity Δ
.../Framework/MockObject/Builder/InvocationMocker.php 85.85% <ø> (ø) 34 <0> (ø) ⬇️
src/Framework/TestCase.php 80.79% <100%> (+0.04%) 338 <1> (+1) ⬆️
src/TextUI/ResultPrinter.php 97.72% <0%> (+0.45%) 78% <0%> (ø) ⬇️
src/TextUI/Command.php 70.97% <0%> (+0.82%) 212% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d02c67b...2894f1e. Read the comment docs.

@sebastianbergmann sebastianbergmann merged commit 1f5e133 into sebastianbergmann:master Sep 6, 2019
@sebastianbergmann sebastianbergmann added the event/code-sprint/2019-09 PHPUnit Code Sprint: September 2019 label Sep 6, 2019
@Ocramius Ocramius deleted the feature/#3120-stubs-implementation branch September 6, 2019 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event/code-sprint/2019-09 PHPUnit Code Sprint: September 2019
Projects
None yet
Development

Successfully merging this pull request may close these issues.

createStub(), createConfiguredStub(), createPartialStub()
2 participants