mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Do not apply non-array package links in ArrayLoader (#11008)
This commit is contained in:
parent
51774693c7
commit
d2d8474013
2 changed files with 38 additions and 10 deletions
|
@ -402,4 +402,31 @@ class ArrayLoaderTest extends TestCase
|
|||
$package = $this->loader->load($config);
|
||||
$this->assertCount(0, $package->getRequires());
|
||||
}
|
||||
|
||||
public function testPackageLinksReplace(): void
|
||||
{
|
||||
$config = array(
|
||||
'name' => 'acme/package',
|
||||
'version' => 'dev-1',
|
||||
'replace' => [
|
||||
'coyote/package' => 'self.version',
|
||||
],
|
||||
);
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertArrayHasKey('coyote/package', $package->getReplaces());
|
||||
$this->assertSame('dev-1', $package->getReplaces()['coyote/package']->getConstraint()->getPrettyString());
|
||||
}
|
||||
|
||||
public function testPackageLinksReplaceInvalid(): void
|
||||
{
|
||||
$config = array(
|
||||
'name' => 'acme/package',
|
||||
'version' => 'dev-1',
|
||||
'replace' => 'coyote/package',
|
||||
);
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertCount(0, $package->getReplaces());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue