1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Handle "versions" option in PathRepository, remove support for "branch-version"

This commit is contained in:
Nicolas Grekas 2021-01-21 20:39:55 +01:00
parent 079e501ac8
commit 725b33ee5a
3 changed files with 57 additions and 0 deletions

View file

@ -97,6 +97,37 @@ class PathRepositoryTest extends TestCase
$this->assertEquals(array('test/path-unversioned', 'test/path-versioned'), $names);
}
public function testLoadPackageWithExplicitVersions()
{
$ioInterface = $this->getMockBuilder('Composer\IO\IOInterface')
->getMock();
$config = new \Composer\Config();
$versionGuesser = null;
$options = array(
'versions' => array(
'test/path-unversioned' => '4.3.2.1',
'test/path-versioned' => '3.2.1.0',
),
);
$repositoryUrl = implode(DIRECTORY_SEPARATOR, array(__DIR__, 'Fixtures', 'path', '*'));
$repository = new PathRepository(array('url' => $repositoryUrl, 'options' => $options), $ioInterface, $config);
$packages = $repository->getPackages();
$versions = array();
$this->assertEquals(2, $repository->count());
$package = $packages[0];
$versions[$package->getName()] = $package->getVersion();
$package = $packages[1];
$versions[$package->getName()] = $package->getVersion();
ksort($versions);
$this->assertSame(array('test/path-unversioned' => '4.3.2.1', 'test/path-versioned' => '3.2.1.0'), $versions);
}
/**
* Verify relative repository URLs remain relative, see #4439
*/