1
0
Fork 0

Update tests

pull/1947/merge
Jordi Boggiano 2013-08-18 23:03:48 +02:00
parent 444bdb2e25
commit e0051a4652
2 changed files with 10 additions and 42 deletions

View File

@ -116,9 +116,7 @@ class GitDriver extends VcsDriver
*/
public function getSource($identifier)
{
$label = array_search($identifier, (array) $this->tags) ?: $identifier;
return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $label);
return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
}
/**

View File

@ -101,25 +101,15 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('test_master', $gitHubDriver->getRootIdentifier());
$dist = $gitHubDriver->getDist($identifier);
$this->assertEquals('zip', $dist['type']);
$this->assertEquals('https://api.github.com/repos/composer/packagist/zipball/v0.0.0', $dist['url']);
$this->assertEquals('v0.0.0', $dist['reference']);
$source = $gitHubDriver->getSource($identifier);
$this->assertEquals('git', $source['type']);
$this->assertEquals($repoSshUrl, $source['url']);
$this->assertEquals('v0.0.0', $source['reference']);
$dist = $gitHubDriver->getDist($sha);
$this->assertEquals('zip', $dist['type']);
$this->assertEquals('https://api.github.com/repos/composer/packagist/zipball/v0.0.0', $dist['url']);
$this->assertEquals('v0.0.0', $dist['reference']);
$this->assertEquals('https://api.github.com/repos/composer/packagist/zipball/SOMESHA', $dist['url']);
$this->assertEquals('SOMESHA', $dist['reference']);
$source = $gitHubDriver->getSource($sha);
$this->assertEquals('git', $source['type']);
$this->assertEquals($repoSshUrl, $source['url']);
$this->assertEquals('v0.0.0', $source['reference']);
$this->assertEquals('SOMESHA', $source['reference']);
}
public function testPublicRepository()
@ -154,25 +144,15 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('test_master', $gitHubDriver->getRootIdentifier());
$dist = $gitHubDriver->getDist($identifier);
$this->assertEquals('zip', $dist['type']);
$this->assertEquals('https://api.github.com/repos/composer/packagist/zipball/v0.0.0', $dist['url']);
$this->assertEquals($identifier, $dist['reference']);
$source = $gitHubDriver->getSource($identifier);
$this->assertEquals('git', $source['type']);
$this->assertEquals($repoUrl, $source['url']);
$this->assertEquals($identifier, $source['reference']);
$dist = $gitHubDriver->getDist($sha);
$this->assertEquals('zip', $dist['type']);
$this->assertEquals('https://api.github.com/repos/composer/packagist/zipball/v0.0.0', $dist['url']);
$this->assertEquals($identifier, $dist['reference']);
$this->assertEquals('https://api.github.com/repos/composer/packagist/zipball/SOMESHA', $dist['url']);
$this->assertEquals($sha, $dist['reference']);
$source = $gitHubDriver->getSource($sha);
$this->assertEquals('git', $source['type']);
$this->assertEquals($repoUrl, $source['url']);
$this->assertEquals($identifier, $source['reference']);
$this->assertEquals($sha, $source['reference']);
}
public function testPublicRepository2()
@ -217,25 +197,15 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('test_master', $gitHubDriver->getRootIdentifier());
$dist = $gitHubDriver->getDist($identifier);
$this->assertEquals('zip', $dist['type']);
$this->assertEquals('https://api.github.com/repos/composer/packagist/zipball/feature/3.2-foo', $dist['url']);
$this->assertEquals($identifier, $dist['reference']);
$source = $gitHubDriver->getSource($identifier);
$this->assertEquals('git', $source['type']);
$this->assertEquals($repoUrl, $source['url']);
$this->assertEquals($identifier, $source['reference']);
$dist = $gitHubDriver->getDist($sha);
$this->assertEquals('zip', $dist['type']);
$this->assertEquals('https://api.github.com/repos/composer/packagist/zipball/feature/3.2-foo', $dist['url']);
$this->assertEquals($identifier, $dist['reference']);
$this->assertEquals('https://api.github.com/repos/composer/packagist/zipball/SOMESHA', $dist['url']);
$this->assertEquals($sha, $dist['reference']);
$source = $gitHubDriver->getSource($sha);
$this->assertEquals('git', $source['type']);
$this->assertEquals($repoUrl, $source['url']);
$this->assertEquals($identifier, $source['reference']);
$this->assertEquals($sha, $source['reference']);
$gitHubDriver->getComposerInformation($identifier);
}