Procházet zdrojové kódy

Package options must be passed as argument to downloader

Luís Otávio Cobucci Oblonczyk před 11 roky
rodič
revize
d4043b6b9a

+ 2 - 2
src/Composer/Downloader/FileDownloader.php

@@ -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;
                 }

+ 8 - 0
tests/Composer/Test/Downloader/FileDownloaderTest.php

@@ -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'))

+ 4 - 0
tests/Composer/Test/Downloader/ZipDownloaderTest.php

@@ -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');