Problem/Motivation

PHPUnit 13.2 deprecates TestCase::expectExceptionMessage() in favor of TestCase::expectExceptionMessageIs() (stricter) or TestCase::expectExceptionMessageIsOrContains() (equivalent to TestCase::expectExceptionMessage()).

See Improved API for exception message expectations

Proposed resolution

Focus on tests from the unit-component test suite and for tests extending directly from TestCase in this issue.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3613394

Command icon 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

mondrake created an issue. See original summary.

mondrake changed the visibility of the branch 3613394-phpunit-13.2-- to hidden.

mondrake changed the visibility of the branch 3613394-phpunit-13.2-- to active.

mondrake’s picture

Status: Active » Needs review
dcam’s picture

Status: Needs review » Needs work

I found one issue with a failing test. Please review my comment on the MR.

Otherwise the changes look good. All uses of expectExceptionMessage() are replaced in the Component tests.

mondrake’s picture

Status: Needs work » Needs review
mondrake’s picture

Version: 11.x-dev » main
dcam’s picture

Status: Needs review » Reviewed & tested by the community

yeah, the exception message does have the period at the end. Maybe you tried on PHPUnit 13 that is stricter than 12 in the matching.

Oh. Of course. Yes, I was testing on 13.2.5. 🙄

I reran the tests on 13.2.5. There were no failures this time. I think this is good to go.

catch’s picture

Status: Reviewed & tested by the community » Needs review

Not sure about using the trait in the test classes.

The idea behind the components is that they add implicit dependencies (or any dependencies) on code from other namespaces, but the test trait does this. Do we need to add drupal/core to require-dev or something?

mondrake’s picture

mondrake’s picture

The trait would be temporary until we bump to PHPUnit 13, though. We will have to remove it at that time, since the new methods in PHPUnit 13 are final and we would get fatals if we don’t.

mondrake’s picture

Issue tags: +blocker