mirror of
https://github.com/composer/composer
synced 2025-05-09 08:32:56 +00:00
Add test for RepositoryManager repo creation
This commit is contained in:
parent
78edca3ad6
commit
5156a60216
1 changed files with 57 additions and 0 deletions
57
tests/Composer/Test/Repository/RepositoryManagerTest.php
Normal file
57
tests/Composer/Test/Repository/RepositoryManagerTest.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Repository;
|
||||
|
||||
use Composer\TestCase;
|
||||
|
||||
class RepositoryManagerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider creationCases
|
||||
*/
|
||||
public function testRepoCreation($type, $config)
|
||||
{
|
||||
$rm = new RepositoryManager(
|
||||
$this->getMock('Composer\IO\IOInterface'),
|
||||
$this->getMock('Composer\Config'),
|
||||
$this->getMockBuilder('Composer\EventDispatcher\EventDispatcher')->disableOriginalConstructor()->getMock()
|
||||
);
|
||||
$rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
|
||||
$rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
|
||||
$rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
|
||||
$rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
|
||||
|
||||
$rm->createRepository('composer', array('url' => 'http://example.org'));
|
||||
$rm->createRepository('composer', array('url' => 'http://example.org'));
|
||||
$rm->createRepository('composer', array('url' => 'http://example.org'));
|
||||
}
|
||||
|
||||
public function creationCases()
|
||||
{
|
||||
return array(
|
||||
array('composer', array('url' => 'http://example.org')),
|
||||
array('vcs', array('url' => 'http://github.com/foo/bar')),
|
||||
array('git', array('url' => 'http://github.com/foo/bar')),
|
||||
array('git', array('url' => 'git@example.org:foo/bar.git')),
|
||||
array('svn', array('url' => 'svn://example.org/foo/bar')),
|
||||
array('pear', array('url' => 'http://pear.example.org/foo')),
|
||||
array('artifact', array('url' => '/path/to/zips')),
|
||||
array('package', array()),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue