diff --git a/src/Composer/Repository/Vcs/VcsDriver.php b/src/Composer/Repository/Vcs/VcsDriver.php index a59472fde..3d7185a34 100644 --- a/src/Composer/Repository/Vcs/VcsDriver.php +++ b/src/Composer/Repository/Vcs/VcsDriver.php @@ -160,7 +160,9 @@ abstract class VcsDriver implements VcsDriverInterface */ protected function getContents($url) { - return $this->remoteFilesystem->getContents($this->originUrl, $url, false); + $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array(); + + return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options); } /** diff --git a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php index fe2b3bf7c..1d1d0d5ae 100644 --- a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php @@ -16,6 +16,7 @@ use Composer\Repository\Vcs\GitLabDriver; use Composer\Config; use Composer\TestCase; use Composer\Util\Filesystem; +use Prophecy\Argument; /** * @author Jérôme Tamarelle @@ -86,7 +87,7 @@ class GitLabDriverTest extends TestCase JSON; $this->remoteFilesystem - ->getContents('gitlab.com', $apiUrl, false) + ->getContents('gitlab.com', $apiUrl, false, array()) ->willReturn($projectData) ->shouldBeCalledTimes(1) ; @@ -125,7 +126,7 @@ JSON; JSON; $this->remoteFilesystem - ->getContents('gitlab.com', $apiUrl, false) + ->getContents('gitlab.com', $apiUrl, false, array()) ->willReturn($projectData) ->shouldBeCalledTimes(1) ; @@ -211,7 +212,7 @@ JSON; JSON; $this->remoteFilesystem - ->getContents('gitlab.com', $apiUrl, false) + ->getContents('gitlab.com', $apiUrl, false, array()) ->willReturn($tagData) ->shouldBeCalledTimes(1) ; @@ -253,7 +254,7 @@ JSON; JSON; $this->remoteFilesystem - ->getContents('gitlab.com', $apiUrl, false) + ->getContents('gitlab.com', $apiUrl, false, array()) ->willReturn($branchData) ->shouldBeCalledTimes(1) ; @@ -384,7 +385,7 @@ JSON; JSON; $this->remoteFilesystem - ->getContents('mycompany.com/gitlab', $apiUrl, false) + ->getContents('mycompany.com/gitlab', $apiUrl, false, array()) ->willReturn($projectData) ->shouldBeCalledTimes(1) ; @@ -394,4 +395,42 @@ JSON; $this->assertEquals($apiUrl, $driver->getApiUrl(), 'API URL is derived from the repository URL'); } + + public function testForwardsOptions() + { + $options = array( + 'ssl' => array( + 'verify_peer' => false, + ) + ); + $projectData = <<remoteFilesystem + ->getContents(Argument::cetera(), $options) + ->willReturn($projectData) + ->shouldBeCalled(); + + $driver = new GitLabDriver( + array('url' => 'https://gitlab.mycompany.local/mygroup/myproject', 'options' => $options), + $this->io->reveal(), + $this->config, + $this->process->reveal(), + $this->remoteFilesystem->reveal() + ); + $driver->initialize(); + } }