Problem/Motivation
I am running the core drupal unit test suite using PHPUnit. The following failure is given.
Drupal\Tests\ComposerIntegrationTest::testVendorCleanup with data set #1 ('Drupal\Composer\Plugin\Vendor...Config', 'defaultConfig')
Failed asserting that an array contains 'behatted/mank'.
The string “BeHatted/Mank” is used in a different test, Drupal\Tests\Composer\Plugin\VendorHardening\ConfigTest
Steps to reproduce
Run PHPUnit against the entire unit test directory:
<testsuite name="passing_unit">
<directory suffix="Test.php">tests/Drupal/Tests</directory>
</testsuite> Proposed resolution
Add * @runInSeparateProcess to ConfigTet:testMixedCaseConfigCleanupPackages
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3161320
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
beakerboyComment #7
smustgrave commentedWondering the exact steps you are taking or if there is something off in your phpunit.xml file?
Have not be able to replicate locally running random tests of all kinds.
Comment #9
neclimdulPretty sure I figured out what's causing this. I'll follow up with some documentation but the details are mostly in the summary. Mostly you just need to run phpunit directly and you see the failure. If you run run-tests which splits everything into its own process you won't.
Comment #11
beakerboyYes, one test must be modifying a file and not correctly cleaning itself after the test. This leaked test data is then contaminating a future test.
Comment #12
neclimdulwoops, got distracted and didn't follow up on those notes and lost all my changes from debugging this. From memory, ConfigTest::testMixedCaseConfigCleanupPackages was interacting with the global composer instance or something. The simple fix was just adding
@runInSeparateProcessto the test and I think that resolved it.Comment #14
neclimdulWell hello old me. Found this again testing PHPUnit 10 changes. Don't think its technically currently a blocker but gets in the way of testing so would be good to get out of the way since its such an easy fix.
Comment #15
smustgrave commentedSimple fix, updated issue summary to include proposed fix.
Comment #18
larowlanCommitted to 11.x and backported to 10.2.x
Nice find, simple fix