SvnDriverTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. private static $gitRepo;
  29. private static $skipped;
  30. public function setUp()
  31. {
  32. if (self::$skipped) {
  33. $this->markTestSkipped(self::$skipped);
  34. }
  35. }
  36. /**
  37. * Provide some examples for {@self::testCredentials()}.
  38. *
  39. * @return array
  40. */
  41. public static function urlProvider()
  42. {
  43. return array(
  44. array('http://till:test@svn.example.org/', ' --no-auth-cache --username "till" --password "test" '),
  45. array('http://svn.apache.org/', ''),
  46. array('svn://johndoe@example.org', ' --no-auth-cache --username "johndoe" --password "" '),
  47. );
  48. }
  49. /**
  50. * @dataProvider urlProvider
  51. */
  52. public function testCredentials($url, $expect)
  53. {
  54. $io = new \Composer\IO\NullIO;
  55. $svn = new SvnDriver($url, $io);
  56. $this->assertEquals($expect, $svn->getSvnCredentialString());
  57. }
  58. }