Isolate config setup to make it reusable at GitDownloaderTest.

main
Marco Villegas 8 years ago
parent 44f94a7b83
commit cb6cfa9635

@ -38,11 +38,7 @@ class GitDownloaderTest extends TestCase
}
}
protected function getDownloaderMock($io = null, $config = null, $executor = null, $filesystem = null)
{
$io = $io ?: $this->getMock('Composer\IO\IOInterface');
$executor = $executor ?: $this->getMock('Composer\Util\ProcessExecutor');
$filesystem = $filesystem ?: $this->getMock('Composer\Util\Filesystem');
protected function setupConfig($config = null) {
if (!$config) {
$config = new Config();
}
@ -50,6 +46,15 @@ class GitDownloaderTest extends TestCase
$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'cmptest-'.md5(uniqid('', true));
$config->merge(array('config' => array('home' => $tmpDir)));
}
return $config;
}
protected function getDownloaderMock($io = null, $config = null, $executor = null, $filesystem = null)
{
$io = $io ?: $this->getMock('Composer\IO\IOInterface');
$executor = $executor ?: $this->getMock('Composer\Util\ProcessExecutor');
$filesystem = $filesystem ?: $this->getMock('Composer\Util\Filesystem');
$config = $this->setupConfig($config);
return new GitDownloader($io, $config, $executor, $filesystem);
}

Loading…
Cancel
Save