Problem/Motivation
See https://www.drupal.org/pift-ci-job/2584887 as an example
There was 1 warning:
1) Drupal\Tests\automatic_updates\Kernel\StatusCheck\RequestedUpdateValidatorTest::testErrorMessageOnEmptyCorePackages
Expecting E_ERROR and E_USER_ERROR is deprecated and will no longer be possible in PHPUnit 10./var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
Steps to reproduce
Proposed resolution
TBD
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork automatic_updates-3339719
Show commands
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 #2
omkar.podey commentedComment #4
phenaproximaWell, this is problematic.
Here's the PR where PHPUnit's expectErrorMessage() was deprecate: https://github.com/sebastianbergmann/phpunit/issues/5062
This PR does not explain the rationale for the change in any helpful way. Sebastian says:
Well, er...okay, then?
@alexpott asked this but has so far received no reply:
Comment #5
phenaproximaLooking into this more closely...I think this worked only by coincidence.
I'm not sure why
$this->expectErrorMessage()was called, but I suspect it was simply an innocent mistake on the part of whoever wrote that line. Because PHPUnit defines that method, it didn't die with a "call to undefined method" or anything like that.Here's what
$this->expectErrorMessage()does: https://github.com/sebastianbergmann/phpunit/commit/3812fd713359a21aed38...It's just a thin wrapper around
$this->expectExceptionMessage()!So, indeed, the validator is legitimately raising a StageValidationException. We are expecting the correct message. We are simply setting up that expectation in a deprecated way.
Therefore, all we have to do here is call
$this->expectExceptionMessage()directly instead, and this problem will go away forever. For clarity and explicitness, we should probably also add a$this->expectException(StageValidationException::class);beforehand, too.Comment #6
phenaproximaComment #7
wim leersYes, core has been using that method for years. 👍
Comment #9
phenaproximaComment #10
wim leers