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
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3179763-5-does-not-perform-assertions.patch | 2.28 KB | tr |
| #2 | 3179763-2-does-not-perform-assertions.patch | 2.05 KB | tr |
Comments
Comment #2
tr commentedComment #3
tr commentedComment #4
tr commentedComment #5
tr commentedWell, 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.
Comment #7
tr commentedCommitted #5.