Closed
Description
Q | A |
---|---|
PHPUnit version | 9.5.10 |
PHP version | 8.0.13 |
Installation Method | Composer 2.2.0, 2.21 |
Summary
After composer install with composer 2.2.0 or 2.2.1, running a PHPUnit test with separate process flag results in an infinite loop. Possibly related to #4835?
Apologies if this is an issue with Composer rather than PHPUnit. I know there were a few reported issues with the Composer 2.2.0 release, but I think they've been marked resolved with the 2.2.1 patch? E.g. composer/composer#10387
Current behavior
PHPUnit appears to keep spawning new child processes. Keeps looping and consuming memory until terminated.
How to reproduce
Ensure no vendor directory exists.
Install composer 2.2.0 or 2.2.1 and composer install:
curl -sS https://getcomposer.org/installer | php -- --filename=composer --version=2.2.1
./composer install
composer.json:
{
"name": "robin/phpunit_separate_process_test",
"require-dev": {
"phpunit/phpunit": "^9.0"
}
}
MyTest.php
<?php
use PHPUnit\Framework\TestCase;
/** @runTestsInSeparateProcesses */
class MyTest extends TestCase
{
/** @test */
public function aTest()
{
$this->assertTrue(true);
}
}
phpunit.xml (created using --generate-configuration
)
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
Run tests:
vendor/bin/phpunit --debug
Expected behavior
Tests should run to completion (as is the case with composer 2.1.14).