Closed (fixed)
Project:
Drupal core
Version:
9.5.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Jul 2022 at 05:05 UTC
Updated:
17 Oct 2022 at 14:49 UTC
Jump to comment: Most recent
I've stumbled over the following inspection in the PHPStorm plugin "Php Inspections (EA Extended)" called "promote ->willReturn*".
This points out PHPUnit MockObject ->expects()->will() which have $this->returnValue as a stub and replaces them with ->expects()->willReturn() (and friends).
I think at the very least it improves readability.
Since this is going to be a big patch touching _a lot_ of Test Classes, this is going to be something we want to (attempt to) commit in the 9.5 beta phase.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #6
spokjeComment #7
spokjeComment #8
spokjeComment #9
longwaveReviewed with git diff --color-words, everything is as expected. The only remaining uses of
$this->returnValue*in core are:Should we just clean these up here as well and be done with it?
Comment #10
spokjeThanks @longwave, changed the last two remaining
$this->returnValueComment #11
longwaveThank you @Spokje!
Comment #12
alexpottCommitted and pushed fdaf5636e4 to 10.1.x and 7b462737ca to 10.0.x. Thanks!
Committed 6cb7c2a and pushed to 9.5.x. Thanks!