PhpUnit 8 tests breaking because of compatibility issue with setUp()

Created on 17 February 2020, almost 5 years ago
Updated 8 March 2024, 9 months ago

Repeatable
Always

Steps to repeat
1. clone git@git.drupal.org:project/drupal.git
2. checkout branch 9.0.x
3. run unit test: cd core && ../vendor\bin\phpunit

Expected Results
Tests run as usual

Actual Results
Warning: include(): Failed opening '{path}\core\tests\Drupal\TestTools\PhpUnitCompatibility\PhpUnit8/../../../../../../sites/simpletest/TestCase.php' for inclusion (include_path='{path}\vendor/pear/archive_tar;{path}\vendor/pear/console_getopt;{path}\vendor/pear/pear-core-minimal/src') in {path}\core\tests\Drupal\TestTools\PhpUnitCompatibility\PhpUnit8\ClassWriter.php on line 51

PHP Fatal error: Declaration of Drupal\Tests\UnitTestCase::setUp() must be compatible with PHPUnit\Framework\TestCase::setUp(): void in C:\Projects\_poc\_drupal\core\tests\Drupal\Tests\UnitTestCase.php on line 19

Cause
The "simpletest" folder does not exist under the sites/ directory

Patch from user mondrake https://www.drupal.org/project/drupal/issues/3063887#comment-13465642 which first creates the folder if it does not exist seems to solve the issue.

🐛 Bug report
Status

Fixed

Version

9.0

Component
PHPUnit 

Last updated 1 day ago

Created by

🇳🇱Netherlands slootjes

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024