123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace Composer\Repository;
- use Composer\TestCase;
- class RepositoryManagerTest extends TestCase
- {
-
- public function testRepoCreation($type, $config, $exception = null)
- {
- if ($exception) {
- $this->setExpectedException($exception);
- }
- $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($type, $config);
- }
- 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('package' => array())),
- array('invalid', array(), 'InvalidArgumentException'),
- );
- }
- }
|