Page MenuHomePhabricator

PHPUnit\Framework\TestFailure not found
Open, Needs TriagePublicBUG REPORT

Description

REL1_38 on php 8.1:

$ php8.1 tests/phpunit/phpunit.php tests/phpunit/includes/filebackend/FileBackendIntegrationTest.php
Using PHP 8.1.5
PHPUnit 8.5.26 

................................................................. 65 / 77 ( 84%)
...........PHP Fatal error:  Class "PHPUnit\Framework\TestFailure" not found in .../includes/libs/filebackend/fileiteration/FileBackendStoreShardListIterator.php on line 0
PHP Stack trace:
[...]
    1.9189   15182048   9. PHPUnit\Framework\TestCase->runBare() .../vendor/phpunit/phpunit/src/Framework/TestResult.php:703
    1.9202   15248472  10. PHPUnit\Framework\TestCase->runTest() .../vendor/phpunit/phpunit/src/Framework/TestCase.php:1110
    1.9202   15248472  11. MediaWikiIntegrationTestCase->testValidCovers() .../vendor/phpunit/phpunit/src/Framework/TestCase.php:1490
    1.9202   15269008  12. PHPUnit\Util\Test::getLinesToBeCovered($className = 'FileBackendIntegrationTest', $methodName = 'testStore') .../tests/phpunit/MediaWikiCoversValidator.php:48
    1.9202   15269384  13. PHPUnit\Util\Test::getLinesToBeCoveredOrUsed($className = 'FileBackendIntegrationTest', $methodName = 'testStore', $mode = 'covers') .../vendor/phpunit/phpunit/src/Util/Test.php:130
    1.9225   15282344  14. interface_exists($interface = 'FileBackendStoreShardDirIterator') .../vendor/phpunit/phpunit/src/Util/Test.php:620
    1.9225   15282448  15. AutoLoader::autoload($className = 'FileBackendStoreShardDirIterator') .../vendor/phpunit/phpunit/src/Util/Test.php:620
    1.9227   15282880  16. require('.../includes/libs/filebackend/fileiteration/FileBackendStoreShardDirIterator.php') .../includes/AutoLoader.php:116
    1.9227   15282880  17. AutoLoader::autoload($className = 'FileBackendStoreShardListIterator') .../includes/libs/filebackend/fileiteration/FileBackendStoreShardDirIterator.php:25
    1.9236   15353104  18. PHPUnit\Framework\Exception->__toString() .../includes/AutoLoader.php:116

Event Timeline

Note that the class is there at vendor/phpunit/phpunit/src/Framework/TestFailure.php and vendor/composer/autoload_static.php as well as vendor/composer/autoload_classmap.php point to it.

Changing the parameter from tests/phpunit/includes/filebackend/FileBackendIntegrationTest.php to tests/phpunit/includes/filebackend and then tests/phpunit/includes and a similar error pops up about not being able to find PHPUnit\Util\Filter which I've confirmed is there in autoload_* and in vendor/phpunit/phpunit/src/Util/Filter.php.

Removing all parameters and running with just php8.1 tests/phpunit/phpunit.php results in:

PHP Fatal error:  Class "PHPUnit\Util\Filter" not found in /home/mah/work/code/mediawiki/REL1_38/includes/libs/filebackend/fileiteration/FileBackendStoreShardListIterator.php on line 0