SvnDriverTest.php 1.5 KB

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