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

Create project: add option to add the repository to the composer.json

This commit is contained in:
Stephan Vock 2020-01-30 17:35:33 +00:00
parent fb93036a70
commit 2a564a9f36
4 changed files with 55 additions and 6 deletions

View file

@ -46,4 +46,24 @@ class RepositoryFactoryTest extends TestCase
'path',
), array_keys($repositoryClasses));
}
/**
* @dataProvider generateRepositoryNameProvider
*/
public function testGenerateRepositoryName($index, array $config, array $existingRepos, $expected)
{
$this->assertSame($expected, RepositoryFactory::generateRepositoryName($index, $config, $existingRepos));
}
public function generateRepositoryNameProvider()
{
return array(
array(0, array(), array(), 0),
array(0, array(), array(array()), '02'),
array(0, array('url' => 'https://example.org'), array(), 'example.org'),
array(0, array('url' => 'https://example.org'), array('example.org' => array()), 'example.org2'),
array('example.org', array('url' => 'https://example.org/repository'), array(), 'example.org'),
array('example.org', array('url' => 'https://example.org/repository'), array('example.org' => array()), 'example.org2'),
);
}
}