SvnDriverTest.php 1.8 KB

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