diff --git a/tests/Composer/Test/InstalledVersionsTest.php b/tests/Composer/Test/InstalledVersionsTest.php index d66005b54..4c27b2e0f 100644 --- a/tests/Composer/Test/InstalledVersionsTest.php +++ b/tests/Composer/Test/InstalledVersionsTest.php @@ -17,6 +17,8 @@ use Composer\Semver\VersionParser; class InstalledVersionsTest extends TestCase { + private static $previousRegisteredLoaders; + /** * @var string */ @@ -28,12 +30,16 @@ class InstalledVersionsTest extends TestCase // class loaders are registered $prop = new \ReflectionProperty('Composer\Autoload\ClassLoader', 'registeredLoaders'); $prop->setAccessible(true); + self::$previousRegisteredLoaders = $prop->getValue(); $prop->setValue(array()); } public static function tearDownAfterClass() { - self::setUpBeforeClass(); + $prop = new \ReflectionProperty('Composer\Autoload\ClassLoader', 'registeredLoaders'); + $prop->setAccessible(true); + $prop->setValue(self::$previousRegisteredLoaders); + InstalledVersions::reload(null); // @phpstan-ignore-line } public function setUp()