HgDriverTest.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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\Test\Repository\Vcs;
  12. use Composer\Repository\Vcs\HgDriver;
  13. use Composer\Test\TestCase;
  14. use Composer\Util\Filesystem;
  15. use Composer\Config;
  16. class HgDriverTest extends TestCase
  17. {
  18. /** @type \Composer\IO\IOInterface|\PHPUnit_Framework_MockObject_MockObject */
  19. private $io;
  20. /** @type Config */
  21. private $config;
  22. /** @type string */
  23. private $home;
  24. public function setUp()
  25. {
  26. $this->io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
  27. $this->home = $this->getUniqueTmpDirectory();
  28. $this->config = new Config();
  29. $this->config->merge(array(
  30. 'config' => array(
  31. 'home' => $this->home,
  32. ),
  33. ));
  34. }
  35. public function tearDown()
  36. {
  37. $fs = new Filesystem;
  38. $fs->removeDirectory($this->home);
  39. }
  40. /**
  41. * @dataProvider supportsDataProvider
  42. */
  43. public function testSupports($repositoryUrl)
  44. {
  45. $this->assertTrue(
  46. HgDriver::supports($this->io, $this->config, $repositoryUrl)
  47. );
  48. }
  49. public function supportsDataProvider()
  50. {
  51. return array(
  52. array('ssh://bitbucket.org/user/repo'),
  53. array('ssh://hg@bitbucket.org/user/repo'),
  54. array('ssh://user@bitbucket.org/user/repo'),
  55. array('https://bitbucket.org/user/repo'),
  56. array('https://user@bitbucket.org/user/repo'),
  57. );
  58. }
  59. }