Skip to content

Commit 8eb9584

Browse files
committed
* move tests from Composer\Test\Vcs\SvnDriverTest to this class
1 parent 8f96786 commit 8eb9584

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

tests/Composer/Test/Util/SvnTest.php

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
namespace Composer\Test\Util;
3+
4+
use Composer\IO\NullIO;
5+
use Composer\Util\Svn;
6+
7+
class SvnTest
8+
{
9+
/**
10+
* Provide some examples for {@self::testCredentials()}.
11+
*
12+
* @return array
13+
*/
14+
public function urlProvider()
15+
{
16+
return array(
17+
array('http://till:[email protected]/', $this->getCmd(" --no-auth-cache --username 'till' --password 'test' ")),
18+
array('http://svn.apache.org/', ''),
19+
array('svn://[email protected]', $this->getCmd(" --no-auth-cache --username 'johndoe' --password '' ")),
20+
);
21+
}
22+
23+
/**
24+
* Test the credential string.
25+
*
26+
* @param string $url The SVN url.
27+
* @param string $expect The expectation for the test.
28+
*
29+
* @dataProvider urlProvider
30+
*/
31+
public function testCredentials($url, $expect)
32+
{
33+
$svn = new Svn($url, new NullIO);
34+
35+
$this->assertEquals($expect, $svn->getCredentialString());
36+
}
37+
38+
public function testInteractiveString()
39+
{
40+
$url = 'http://svn.example.org';
41+
42+
$svn = new Svn($url, new NullIO());
43+
44+
$this->assertEquals(
45+
"svn ls --non-interactive 'http://svn.example.org'",
46+
$svn->getCommand('svn ls', $url)
47+
);
48+
}
49+
}

0 commit comments

Comments
 (0)