Problem/Motivation

#3462264: Skip unsupported methods in rest/jsonapi tests in an efficient way skipped some REST tests that exit immediately. But since that landed, PHPUnit has changed the test runner and #[Before] does not skip setUp():

$ ddev test core/modules/comment/tests/src/Functional/Rest/CommentXmlBasicAuthTest.php --filter testPostDxWithoutCriticalBaseFields
PHPUnit 11.5.50 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.5.1
Configuration: /var/www/html/drupal/core/phpunit.xml.dist

S                                                                   1 / 1 (100%)

Time: 00:07.197, Memory: 6.00 MB

OK, but some tests were skipped!
Tests: 1, Assertions: 0, Skipped: 1.

Steps to reproduce

Proposed resolution

Move the #[Before] code to setUp().

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3572055

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

longwave created an issue. See original summary.

longwave’s picture

Status: Active » Needs review

This affects 116 tests, using 7 seconds each of my CPU time, which would be 13.5 minutes total. Not sure how much impact this will have on CI, but surely some?

After this fix:

$ ddev test core/modules/comment/tests/src/Functional/Rest/CommentXmlBasicAuthTest.php --filter testPostDxWithoutCriticalBaseFields
PHPUnit 11.5.50 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.5.1
Configuration: /var/www/html/drupal/core/phpunit.xml.dist

S                                                                   1 / 1 (100%)

Time: 00:00.224, Memory: 6.00 MB

OK, but some tests were skipped!
Tests: 1, Assertions: 0, Skipped: 1.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Looks like a good cleanup to me. Not sure how to measure but even a few seconds is worth it right?

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to main, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • catch committed 88db51b4 on main
    fix: #3572055 Fix skip for unsupported methods on REST tests
    
    By:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.