RepositoryManagerTest.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Repository;
  12. use Composer\TestCase;
  13. class RepositoryManagerTest extends TestCase
  14. {
  15. /**
  16. * @dataProvider creationCases
  17. */
  18. public function testRepoCreation($type, $config)
  19. {
  20. $rm = new RepositoryManager(
  21. $this->getMock('Composer\IO\IOInterface'),
  22. $this->getMock('Composer\Config'),
  23. $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher')->disableOriginalConstructor()->getMock()
  24. );
  25. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  26. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  27. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  28. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  29. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  30. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  31. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  32. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  33. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  34. $rm->createRepository('composer', array('url' => 'http://example.org'));
  35. $rm->createRepository('composer', array('url' => 'http://example.org'));
  36. $rm->createRepository('composer', array('url' => 'http://example.org'));
  37. }
  38. public function creationCases()
  39. {
  40. return array(
  41. array('composer', array('url' => 'http://example.org')),
  42. array('vcs', array('url' => 'http://github.com/foo/bar')),
  43. array('git', array('url' => 'http://github.com/foo/bar')),
  44. array('git', array('url' => 'git@example.org:foo/bar.git')),
  45. array('svn', array('url' => 'svn://example.org/foo/bar')),
  46. array('pear', array('url' => 'http://pear.example.org/foo')),
  47. array('artifact', array('url' => '/path/to/zips')),
  48. array('package', array()),
  49. );
  50. }
  51. }