mirror of
https://github.com/composer/composer
synced 2025-05-10 09:02:59 +00:00
* move tests from Composer\Test\Vcs\SvnDriverTest to this class
This commit is contained in:
parent
8f96786693
commit
8eb9584173
1 changed files with 49 additions and 0 deletions
49
tests/Composer/Test/Util/SvnTest.php
Normal file
49
tests/Composer/Test/Util/SvnTest.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
namespace Composer\Test\Util;
|
||||
|
||||
use Composer\IO\NullIO;
|
||||
use Composer\Util\Svn;
|
||||
|
||||
class SvnTest
|
||||
{
|
||||
/**
|
||||
* Provide some examples for {@self::testCredentials()}.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function urlProvider()
|
||||
{
|
||||
return array(
|
||||
array('http://till:test@svn.example.org/', $this->getCmd(" --no-auth-cache --username 'till' --password 'test' ")),
|
||||
array('http://svn.apache.org/', ''),
|
||||
array('svn://johndoe@example.org', $this->getCmd(" --no-auth-cache --username 'johndoe' --password '' ")),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the credential string.
|
||||
*
|
||||
* @param string $url The SVN url.
|
||||
* @param string $expect The expectation for the test.
|
||||
*
|
||||
* @dataProvider urlProvider
|
||||
*/
|
||||
public function testCredentials($url, $expect)
|
||||
{
|
||||
$svn = new Svn($url, new NullIO);
|
||||
|
||||
$this->assertEquals($expect, $svn->getCredentialString());
|
||||
}
|
||||
|
||||
public function testInteractiveString()
|
||||
{
|
||||
$url = 'http://svn.example.org';
|
||||
|
||||
$svn = new Svn($url, new NullIO());
|
||||
|
||||
$this->assertEquals(
|
||||
"svn ls --non-interactive 'http://svn.example.org'",
|
||||
$svn->getCommand('svn ls', $url)
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue