From cb6cfa9635b1978f288ceec59eb7644a839f23c7 Mon Sep 17 00:00:00 2001 From: Marco Villegas Date: Sat, 18 Jun 2016 19:21:50 -0500 Subject: [PATCH] Isolate config setup to make it reusable at GitDownloaderTest. --- .../Test/Downloader/GitDownloaderTest.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/Composer/Test/Downloader/GitDownloaderTest.php b/tests/Composer/Test/Downloader/GitDownloaderTest.php index 946143862..dd14b1938 100644 --- a/tests/Composer/Test/Downloader/GitDownloaderTest.php +++ b/tests/Composer/Test/Downloader/GitDownloaderTest.php @@ -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); }