[wp-trac] [WordPress Trac] #60551: WordPress test lib isn't compatible with latest phpunit
WordPress Trac
noreply at wordpress.org
Thu Feb 15 15:40:38 UTC 2024
#60551: WordPress test lib isn't compatible with latest phpunit
------------------------------+-----------------------------
Reporter: jujuguru | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version: 6.4.3
Severity: major | Keywords:
Focuses: |
------------------------------+-----------------------------
**Current setup:**
PHP version 8.2.15
WordPress version 6.4.3
PHPUnit version 11.0.3
**Issue:**
Trying to get unit testing for plugin development running but there is a
call to a deprecated/no-longer present method the following file:
/tmp/wordpress-tests-lib/includes/abstract-testcase.php
{{{
Error: Call to undefined method
PHPUnit\Util\Test::parseTestMethodAnnotations()
/tmp/wordpress-tests-lib/includes/abstract-testcase.php:546
/tmp/wordpress-tests-lib/includes/abstract-testcase.php:137
/var/www/html/wp-content/plugins/solomons-services/vendor/yoast/phpunit-
polyfills/src/TestCases/TestCasePHPUnitGte8.php:60
}}}
**What I discovered**
Strictly this a breaking change in the PHPUnit codebase implied by the
class annotation:
''@internal This class is not covered by the backward compatibility
promise for PHPUnit''.
The method
[https://github.com/sebastianbergmann/phpunit/blob/9.6.16/src/Util/Test.php#L334
parseTestMethodAnnotations() was present upto and including 9.6.16] of
PHPUnit however the file underwent a massive change and it's
[https://github.com/sebastianbergmann/phpunit/blob/10.0.0/src/Util/Test.php
not been present since 10.0.0].
**Workaround**
Comment out the call to PHPUnit\Util\Test::parseTestMethodAnnotations() in
abstact-testcase.php and the tests will run with a deprecation warning
related to metadata and annotations but that doesn't affect this issue. I
don't at this stage know if there's any other side effects as a result of
this workaround.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60551>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list