1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Add functional tests for the installer, fixes #580

This commit is contained in:
Jordi Boggiano 2012-05-13 21:40:42 +02:00
parent 0a0a6b1813
commit 4505df29df
9 changed files with 327 additions and 11 deletions

View file

@ -19,6 +19,18 @@ use Composer\Config;
class GitHubDriverTest extends \PHPUnit_Framework_TestCase
{
private $config;
public function setUp()
{
$this->config = new Config();
$this->config->merge(array(
'config' => array(
'home' => sys_get_temp_dir() . '/composer-test',
),
));
}
public function testPrivateRepository()
{
$scheme = extension_loaded('openssl') ? 'https' : 'http';
@ -62,7 +74,7 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false))
->will($this->returnValue('{"master_branch": "test_master"}'));
$gitHubDriver = new GitHubDriver($repoUrl, $io, new Config(), null, $remoteFilesystem);
$gitHubDriver = new GitHubDriver($repoUrl, $io, $this->config, null, $remoteFilesystem);
$gitHubDriver->initialize();
$this->setAttribute($gitHubDriver, 'tags', array($identifier => $sha));
@ -112,7 +124,7 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false))
->will($this->returnValue('{"master_branch": "test_master"}'));
$gitHubDriver = new GitHubDriver($repoUrl, $io, new Config(), null, $remoteFilesystem);
$gitHubDriver = new GitHubDriver($repoUrl, $io, $this->config, null, $remoteFilesystem);
$gitHubDriver->initialize();
$this->setAttribute($gitHubDriver, 'tags', array($identifier => $sha));
@ -171,13 +183,6 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
$fs = new Filesystem();
$fs->removeDirectory(sys_get_temp_dir() . '/composer-test');
$config = new Config();
$config->merge(array(
'config' => array(
'home' => sys_get_temp_dir() . '/composer-test',
),
));
$process->expects($this->at(0))
->method('execute')
->with($this->stringContains($repoSshUrl))
@ -207,7 +212,7 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
->method('splitLines')
->will($this->returnValue(array('* test_master')));
$gitHubDriver = new GitHubDriver($repoUrl, $io, $config, $process, $remoteFilesystem);
$gitHubDriver = new GitHubDriver($repoUrl, $io, $this->config, $process, $remoteFilesystem);
$gitHubDriver->initialize();
$this->assertEquals('test_master', $gitHubDriver->getRootIdentifier());