Package options must be passed as argument to downloader

main
Luís Otávio Cobucci Oblonczyk 11 years ago
parent 2e2b66b16e
commit d4043b6b9a

@ -103,7 +103,7 @@ class FileDownloader implements DownloaderInterface
$retries = 3;
while ($retries--) {
try {
$this->rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress);
$this->rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getOptions());
break;
} catch (TransportException $e) {
// if we got an http response with a proper code, then requesting again will probably not help, abort
@ -132,7 +132,7 @@ class FileDownloader implements DownloaderInterface
) {
throw $e;
}
$this->rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress);
$this->rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getOptions());
} else {
throw $e;
}

@ -89,6 +89,10 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
->method('getDistUrl')
->will($this->returnValue('http://example.com/script.js'))
;
$packageMock->expects($this->atLeastOnce())
->method('getOptions')
->will($this->returnValue(array()))
;
do {
$path = sys_get_temp_dir().'/'.md5(time().mt_rand());
@ -130,6 +134,10 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
->method('getDistUrl')
->will($this->returnValue('http://example.com/script.js'))
;
$packageMock->expects($this->atLeastOnce())
->method('getOptions')
->will($this->returnValue(array()))
;
$packageMock->expects($this->any())
->method('getDistSha1Checksum')
->will($this->returnValue('invalid'))

@ -30,6 +30,10 @@ class ZipDownloaderTest extends \PHPUnit_Framework_TestCase
->method('getDistUrl')
->will($this->returnValue('file://'.__FILE__))
;
$packageMock->expects($this->atLeastOnce())
->method('getOptions')
->will($this->returnValue(array()))
;
$io = $this->getMock('Composer\IO\IOInterface');
$config = $this->getMock('Composer\Config');

Loading…
Cancel
Save