SvnDriverTest.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. * Till Klampaeckel <till@php.net>
  8. *
  9. * For the full copyright and license information, please view the LICENSE
  10. * file that was distributed with this source code.
  11. */
  12. // is this namespace correct? I mean, who cares... but?
  13. namespace Composer\Test\Json;
  14. /**
  15. * Why does composer force an install when I need an autoloader instead?
  16. */
  17. $root = dirname(dirname(dirname(dirname(__DIR__)))) . '/src';
  18. set_include_path($root . ':' . get_include_path());
  19. require_once $root . '/Composer/Autoload/ClassLoader.php';
  20. $loader = new \Composer\Autoload\ClassLoader;
  21. $loader->register();
  22. $loader->setUseIncludePath(true);
  23. //use Symfony\Component\Process\ExecutableFinder;
  24. //use Composer\Package\Dumper\ArrayDumper;
  25. use Composer\Repository\VcsRepository;
  26. use Composer\Repository\Vcs\SvnDriver;
  27. //use Composer\Util\Filesystem;
  28. //use Composer\Util\ProcessExecutor;
  29. use Composer\IO\NullIO;
  30. class SvnDriverTest extends \PHPUnit_Framework_TestCase
  31. {
  32. private static $gitRepo;
  33. private static $skipped;
  34. public function setUp()
  35. {
  36. if (self::$skipped) {
  37. $this->markTestSkipped(self::$skipped);
  38. }
  39. }
  40. /**
  41. * Provide some examples for {@self::testCredentials()}.
  42. *
  43. * @return array
  44. */
  45. public static function urlProvider()
  46. {
  47. return array(
  48. array('http://till:test@svn.example.org/', ' --no-auth-cache --username "till" --password "test" '),
  49. array('http://svn.apache.org/', ''),
  50. array('svn://johndoe@example.org', ' --no-auth-cache --username "johndoe" --password "" '),
  51. );
  52. }
  53. /**
  54. * @dataProvider urlProvider
  55. */
  56. public function testCredentials($url, $expect)
  57. {
  58. $io = new \Composer\IO\NullIO;
  59. $svn = new SvnDriver($url, $io);
  60. $this->assertEquals($expect, $svn->getSvnCredentialString());
  61. }
  62. }