Browse Source

Update perforce code

Jordi Boggiano 11 years ago
parent
commit
97873a27af

+ 6 - 6
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);
     }
 
     /**

+ 4 - 5
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');
     }
-
 }