1
0
Fork 0

Attempt fixing usage of InstalledVersions in tests

pull/10512/head
Jordi Boggiano 2022-02-02 16:08:36 +01:00
parent 4ce11ab4ab
commit 7591ef0084
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,8 @@ use Composer\Semver\VersionParser;
class InstalledVersionsTest extends TestCase class InstalledVersionsTest extends TestCase
{ {
private static $previousRegisteredLoaders;
/** /**
* @var string * @var string
*/ */
@ -28,12 +30,16 @@ class InstalledVersionsTest extends TestCase
// class loaders are registered // class loaders are registered
$prop = new \ReflectionProperty('Composer\Autoload\ClassLoader', 'registeredLoaders'); $prop = new \ReflectionProperty('Composer\Autoload\ClassLoader', 'registeredLoaders');
$prop->setAccessible(true); $prop->setAccessible(true);
self::$previousRegisteredLoaders = $prop->getValue();
$prop->setValue(array()); $prop->setValue(array());
} }
public static function tearDownAfterClass() 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() public function setUp()