From 97873a27af2c382a93ebc909662d1a7150d51ec7 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 19 Oct 2013 17:55:30 +0200 Subject: [PATCH] Update perforce code --- src/Composer/Downloader/PerforceDownloader.php | 12 ++++++------ .../Test/Downloader/PerforceDownloaderTest.php | 9 ++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Composer/Downloader/PerforceDownloader.php b/src/Composer/Downloader/PerforceDownloader.php index 8892e4b74..42f424057 100644 --- a/src/Composer/Downloader/PerforceDownloader.php +++ b/src/Composer/Downloader/PerforceDownloader.php @@ -26,13 +26,13 @@ class PerforceDownloader extends VcsDownloader /** * {@inheritDoc} */ - public function doDownload(PackageInterface $package, $path) + public function doDownload(PackageInterface $package, $path, $url) { $ref = $package->getSourceReference(); $label = $this->getLabelFromSourceReference($ref); $this->io->write(' Cloning ' . $ref); - $this->initPerforce($package, $path); + $this->initPerforce($package, $path, $url); $this->perforce->setStream($ref); $this->perforce->p4Login($this->io); $this->perforce->writeP4ClientSpec(); @@ -51,7 +51,7 @@ class PerforceDownloader extends VcsDownloader return null; } - public function initPerforce($package, $path) + public function initPerforce($package, $path, $url) { if (!empty($this->perforce)) { $this->perforce->initializePath($path); @@ -63,7 +63,7 @@ class PerforceDownloader extends VcsDownloader if ($repository instanceof VcsRepository) { $repoConfig = $this->getRepoConfig($repository); } - $this->perforce = Perforce::create($repoConfig, $package->getSourceUrl(), $path, $this->process, $this->io); + $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io); } private function getRepoConfig(VcsRepository $repository) @@ -74,9 +74,9 @@ class PerforceDownloader extends VcsDownloader /** * {@inheritDoc} */ - public function doUpdate(PackageInterface $initial, PackageInterface $target, $path) + public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url) { - $this->doDownload($target, $path); + $this->doDownload($target, $path, $url); } /** diff --git a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php index 7562f7fca..b1d3d8fb9 100644 --- a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php +++ b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php @@ -22,7 +22,7 @@ use Composer\IO\IOInterface; */ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase { - + protected $config; protected $downloader; protected $io; @@ -82,7 +82,7 @@ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase protected function getRepoConfig() { - return array('url' => 'TEST_URL', 'p4user' => 'TEST_USER'); + return array('url' => 'TEST_URL', 'p4user' => 'TEST_USER'); } protected function getMockRepository(array $repoConfig, IOInterface $io, Config $config) @@ -129,7 +129,7 @@ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase $perforce->expects($this->at(5))->method('syncCodeBase')->with($label); $perforce->expects($this->at(6))->method('cleanupClientSpec'); $this->downloader->setPerforce($perforce); - $this->downloader->doDownload($this->package, $this->testPath); + $this->downloader->doDownload($this->package, $this->testPath, 'url'); } /** @@ -152,7 +152,6 @@ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase $perforce->expects($this->at(5))->method('syncCodeBase')->with($label); $perforce->expects($this->at(6))->method('cleanupClientSpec'); $this->downloader->setPerforce($perforce); - $this->downloader->doDownload($this->package, $this->testPath); + $this->downloader->doDownload($this->package, $this->testPath, 'url'); } - }