diff --git a/bin/simple-phpunit.php b/bin/simple-phpunit.php index 590a886..78a6ff7 100644 --- a/bin/simple-phpunit.php +++ b/bin/simple-phpunit.php @@ -138,6 +138,7 @@ 'COMPOSER' => 'composer.json', 'COMPOSER_VENDOR_DIR' => 'vendor', 'COMPOSER_BIN_DIR' => 'bin', + 'COMPOSER_NO_INTERACTION' => '1', 'SYMFONY_SIMPLE_PHPUNIT_BIN_DIR' => __DIR__, ]; @@ -234,10 +235,10 @@ @copy("$PHPUNIT_VERSION_DIR/phpunit.xsd", 'phpunit.xsd'); chdir("$PHPUNIT_VERSION_DIR"); if ($SYMFONY_PHPUNIT_REMOVE) { - $passthruOrFail("$COMPOSER remove --no-update --no-interaction ".$SYMFONY_PHPUNIT_REMOVE); + $passthruOrFail("$COMPOSER remove --no-update ".$SYMFONY_PHPUNIT_REMOVE); } if ($SYMFONY_PHPUNIT_REQUIRE) { - $passthruOrFail("$COMPOSER require --no-update --no-interaction ".$SYMFONY_PHPUNIT_REQUIRE); + $passthruOrFail("$COMPOSER require --no-update ".$SYMFONY_PHPUNIT_REQUIRE); } if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) { $passthruOrFail("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\""); diff --git a/bootstrap.php b/bootstrap.php index f11b7ab..50157ae 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -14,7 +14,11 @@ use Symfony\Bridge\PhpUnit\DeprecationErrorHandler; // Detect if we need to serialize deprecations to a file. -if (in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && $file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) { +if ( + // Skip if we're using PHPUnit >=10 + !class_exists(PHPUnit\Metadata\Metadata::class) + && in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && $file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE') +) { DeprecationErrorHandler::collectDeprecations($file); return; @@ -46,6 +50,10 @@ } } -if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) { +if ( + // Skip if we're using PHPUnit >=10 + !class_exists(PHPUnit\Metadata\Metadata::class, false) + && 'disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER') +) { DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER')); } diff --git a/composer.json b/composer.json index 1283dfe..de9101f 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,9 @@ "name": "symfony/phpunit-bridge", "type": "symfony-bridge", "description": "Provides utilities for PHPUnit, especially user deprecation notices management", - "keywords": [], + "keywords": [ + "testing" + ], "homepage": "https://symfony.com", "license": "MIT", "authors": [