|
@@ -44,10 +44,13 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
|
|
$packageMock->expects($this->any())
|
|
|
->method('getSourceReference')
|
|
|
- ->will($this->returnValue('ref'));
|
|
|
+ ->will($this->returnValue('1234567890123456789012345678901234567890'));
|
|
|
$packageMock->expects($this->any())
|
|
|
->method('getSourceUrl')
|
|
|
->will($this->returnValue('https://example.com/composer/composer'));
|
|
|
+ $packageMock->expects($this->any())
|
|
|
+ ->method('getPrettyVersion')
|
|
|
+ ->will($this->returnValue('dev-master'));
|
|
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
|
|
|
|
|
$expectedGitCommand = $this->getCmd("git clone 'https://example.com/composer/composer' 'composerPath' && cd 'composerPath' && git remote add composer 'https://example.com/composer/composer' && git fetch composer");
|
|
@@ -58,7 +61,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
$processExecutor->expects($this->at(1))
|
|
|
->method('execute')
|
|
|
- ->with($this->equalTo($this->getCmd("git checkout 'ref' && git reset --hard 'ref'")), $this->equalTo(null), $this->equalTo('composerPath'))
|
|
|
+ ->with($this->equalTo($this->getCmd("git checkout '1234567890123456789012345678901234567890' && git reset --hard '1234567890123456789012345678901234567890'")), $this->equalTo(null), $this->equalTo('composerPath'))
|
|
|
->will($this->returnValue(0));
|
|
|
|
|
|
$downloader = $this->getDownloaderMock(null, $processExecutor);
|
|
@@ -74,6 +77,9 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
|
$packageMock->expects($this->any())
|
|
|
->method('getSourceUrl')
|
|
|
->will($this->returnValue('https://github.com/composer/composer'));
|
|
|
+ $packageMock->expects($this->any())
|
|
|
+ ->method('getPrettyVersion')
|
|
|
+ ->will($this->returnValue('1.0.0'));
|
|
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
|
|
|
|
|
$expectedGitCommand = $this->getCmd("git clone 'git://github.com/composer/composer' 'composerPath' && cd 'composerPath' && git remote add composer 'git://github.com/composer/composer' && git fetch composer");
|
|
@@ -101,6 +107,11 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
|
->will($this->returnValue(0));
|
|
|
|
|
|
$processExecutor->expects($this->at(6))
|
|
|
+ ->method('execute')
|
|
|
+ ->with($this->equalTo('git branch -r'))
|
|
|
+ ->will($this->returnValue(0));
|
|
|
+
|
|
|
+ $processExecutor->expects($this->at(7))
|
|
|
->method('execute')
|
|
|
->with($this->equalTo($this->getCmd("git checkout 'ref' && git reset --hard 'ref'")), $this->equalTo(null), $this->equalTo('composerPath'))
|
|
|
->will($this->returnValue(0));
|
|
@@ -159,6 +170,9 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
|
$packageMock->expects($this->any())
|
|
|
->method('getSourceUrl')
|
|
|
->will($this->returnValue('https://github.com/composer/composer'));
|
|
|
+ $packageMock->expects($this->any())
|
|
|
+ ->method('getPrettyVersion')
|
|
|
+ ->will($this->returnValue('1.0.0'));
|
|
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
|
|
$processExecutor->expects($this->at(0))
|
|
|
->method('execute')
|
|
@@ -173,6 +187,10 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
|
->with($this->equalTo($expectedGitUpdateCommand))
|
|
|
->will($this->returnValue(0));
|
|
|
$processExecutor->expects($this->at(3))
|
|
|
+ ->method('execute')
|
|
|
+ ->with($this->equalTo('git branch -r'))
|
|
|
+ ->will($this->returnValue(0));
|
|
|
+ $processExecutor->expects($this->at(4))
|
|
|
->method('execute')
|
|
|
->with($this->equalTo($this->getCmd("git checkout 'ref' && git reset --hard 'ref'")), $this->equalTo(null), $this->equalTo('composerPath'))
|
|
|
->will($this->returnValue(0));
|