Our PHP 7.4 tests have been failing for the past ~two weeks because DrupalCI started to use PHPUnit 9 for PHP 7.4 tests.

See https://www.drupal.org/pift-ci-job/1865072 for the failing tests.
See #3127141: Use PHPUnit 9 for PHP 7.4+, while keeping support for PHPUnit 8.4 in PHP 7.3 (committed 13 October) for the core issue that changed the PHPUnit version.

Apparently, the @doesNotPerformAssertions test annotation, which is intended to inform PHPUnit that the annotated test deliberately does not perform assertions, has stopped working in PHPUnit 9. This annotation is still documented as a valid annotation in PHPUnit 9 https://phpunit.readthedocs.io/en/9.3/annotations.html#doesnotperformass... so it may be that this is a problem with DrupalCI rather than PHPUnit 9.

Regardless, it affects only two tests, and only for PHP 7.4 tests. Here is a workaround suggested by @larowlan in Slack thread https://drupal.slack.com/archives/C223PR743/p1603209478083000

Comments

TR created an issue. See original summary.

tr’s picture

Status: Active » Needs review
StatusFileSize
new2.05 KB
tr’s picture

Issue summary: View changes
tr’s picture

Issue summary: View changes
tr’s picture

Well, that was a test. Now let's see if we can leave off @doesNotPerformAssertions completely. I don't like this option so much because the annotation is important documentation for the test function. Using addToAssertionCount(1) to add a bogus assertion to the test is a really ugly thing to do and shouldn't be necessary because the annotation shouldn't break with PHPUnit 9.

  • TR committed 20c5057 on 8.x-3.x
    Issue #3179763 by TR: PHPUnit 9 ignores @doesNotPerformAssertions
    
tr’s picture

Status: Needs review » Fixed

Committed #5.

Status: Fixed » Closed (fixed)

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