|
@@ -209,7 +209,6 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
|
public function testUpdate()
|
|
|
{
|
|
|
$expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url composer 'git://github.com/composer/composer' && git fetch composer && git fetch --tags composer");
|
|
|
- $expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain --untracked-files=no");
|
|
|
|
|
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
|
|
$packageMock->expects($this->any())
|
|
@@ -223,22 +222,18 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
|
->will($this->returnValue('1.0.0'));
|
|
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
|
|
$processExecutor->expects($this->at(0))
|
|
|
- ->method('execute')
|
|
|
- ->with($this->equalTo($expectedGitResetCommand))
|
|
|
- ->will($this->returnValue(0));
|
|
|
- $processExecutor->expects($this->at(1))
|
|
|
->method('execute')
|
|
|
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v")))
|
|
|
->will($this->returnValue(0));
|
|
|
- $processExecutor->expects($this->at(2))
|
|
|
+ $processExecutor->expects($this->at(1))
|
|
|
->method('execute')
|
|
|
->with($this->equalTo($expectedGitUpdateCommand))
|
|
|
->will($this->returnValue(0));
|
|
|
- $processExecutor->expects($this->at(3))
|
|
|
+ $processExecutor->expects($this->at(2))
|
|
|
->method('execute')
|
|
|
->with($this->equalTo('git branch -r'))
|
|
|
->will($this->returnValue(0));
|
|
|
- $processExecutor->expects($this->at(4))
|
|
|
+ $processExecutor->expects($this->at(3))
|
|
|
->method('execute')
|
|
|
->with($this->equalTo($this->getCmd("git checkout 'ref' && git reset --hard 'ref'")), $this->equalTo(null), $this->equalTo('composerPath'))
|
|
|
->will($this->returnValue(0));
|
|
@@ -253,7 +248,6 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
|
public function testUpdateThrowsRuntimeExceptionIfGitCommandFails()
|
|
|
{
|
|
|
$expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url composer 'git://github.com/composer/composer' && git fetch composer && git fetch --tags composer");
|
|
|
- $expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain --untracked-files=no");
|
|
|
|
|
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
|
|
$packageMock->expects($this->any())
|
|
@@ -264,14 +258,10 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
|
->will($this->returnValue('https://github.com/composer/composer'));
|
|
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
|
|
$processExecutor->expects($this->at(0))
|
|
|
- ->method('execute')
|
|
|
- ->with($this->equalTo($expectedGitResetCommand))
|
|
|
- ->will($this->returnValue(0));
|
|
|
- $processExecutor->expects($this->at(1))
|
|
|
->method('execute')
|
|
|
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v")))
|
|
|
->will($this->returnValue(0));
|
|
|
- $processExecutor->expects($this->at(2))
|
|
|
+ $processExecutor->expects($this->at(1))
|
|
|
->method('execute')
|
|
|
->with($this->equalTo($expectedGitUpdateCommand))
|
|
|
->will($this->returnValue(1));
|