FossilDriverTest.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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\FossilDriver;
  13. use Composer\Config;
  14. use Composer\TestCase;
  15. use Composer\Util\Filesystem;
  16. use Composer\Util\Platform;
  17. class FossilDriverTest extends TestCase
  18. {
  19. protected $home;
  20. protected $config;
  21. public function setUp()
  22. {
  23. $this->home = $this->getUniqueTmpDirectory();
  24. $this->config = new Config();
  25. $this->config->merge(array(
  26. 'config' => array(
  27. 'home' => $this->home,
  28. ),
  29. ));
  30. }
  31. public function tearDown()
  32. {
  33. $fs = new Filesystem();
  34. $fs->removeDirectory($this->home);
  35. }
  36. private function getCmd($cmd)
  37. {
  38. if (Platform::isWindows()) {
  39. return strtr($cmd, "'", '"');
  40. }
  41. return $cmd;
  42. }
  43. public static function supportProvider()
  44. {
  45. return array(
  46. array('http://fossil.kd2.org/kd2fw/', true),
  47. array('https://chiselapp.com/user/rkeene/repository/flint/index', true),
  48. array('ssh://fossil.kd2.org/kd2fw.fossil', true),
  49. );
  50. }
  51. /**
  52. * @dataProvider supportProvider
  53. */
  54. public function testSupport($url, $assertion)
  55. {
  56. $config = new Config();
  57. $result = FossilDriver::supports($this->getMockBuilder('Composer\IO\IOInterface')->getMock(), $config, $url);
  58. $this->assertEquals($assertion, $result);
  59. }
  60. }