|
@@ -50,7 +50,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
->will($this->returnValue('https://example.com/composer/composer'));
|
|
->will($this->returnValue('https://example.com/composer/composer'));
|
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
|
|
|
|
|
- $expectedGitCommand = $this->getCmd("git clone 'https://example.com/composer/composer' 'composerPath' && cd 'composerPath' && git checkout 'ref' && git reset --hard 'ref'");
|
|
|
|
|
|
+ $expectedGitCommand = $this->getCmd("git clone 'https://example.com/composer/composer' 'composerPath' && cd 'composerPath' && git checkout 'ref' && git reset --hard 'ref' && git remote add composer 'https://example.com/composer/composer'");
|
|
$processExecutor->expects($this->once())
|
|
$processExecutor->expects($this->once())
|
|
->method('execute')
|
|
->method('execute')
|
|
->with($this->equalTo($expectedGitCommand))
|
|
->with($this->equalTo($expectedGitCommand))
|
|
@@ -71,19 +71,19 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
->will($this->returnValue('https://github.com/composer/composer'));
|
|
->will($this->returnValue('https://github.com/composer/composer'));
|
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
|
|
|
|
|
- $expectedGitCommand = $this->getCmd("git clone 'git://github.com/composer/composer' 'composerPath' && cd 'composerPath' && git checkout 'ref' && git reset --hard 'ref'");
|
|
|
|
|
|
+ $expectedGitCommand = $this->getCmd("git clone 'git://github.com/composer/composer' 'composerPath' && cd 'composerPath' && git checkout 'ref' && git reset --hard 'ref' && git remote add composer 'git://github.com/composer/composer'");
|
|
$processExecutor->expects($this->at(0))
|
|
$processExecutor->expects($this->at(0))
|
|
->method('execute')
|
|
->method('execute')
|
|
->with($this->equalTo($expectedGitCommand))
|
|
->with($this->equalTo($expectedGitCommand))
|
|
->will($this->returnValue(1));
|
|
->will($this->returnValue(1));
|
|
|
|
|
|
- $expectedGitCommand = $this->getCmd("git clone 'https://github.com/composer/composer' 'composerPath' && cd 'composerPath' && git checkout 'ref' && git reset --hard 'ref'");
|
|
|
|
|
|
+ $expectedGitCommand = $this->getCmd("git clone 'https://github.com/composer/composer' 'composerPath' && cd 'composerPath' && git checkout 'ref' && git reset --hard 'ref' && git remote add composer 'https://github.com/composer/composer'");
|
|
$processExecutor->expects($this->at(1))
|
|
$processExecutor->expects($this->at(1))
|
|
->method('execute')
|
|
->method('execute')
|
|
->with($this->equalTo($expectedGitCommand))
|
|
->with($this->equalTo($expectedGitCommand))
|
|
->will($this->returnValue(1));
|
|
->will($this->returnValue(1));
|
|
|
|
|
|
- $expectedGitCommand = $this->getCmd("git clone 'http://github.com/composer/composer' 'composerPath' && cd 'composerPath' && git checkout 'ref' && git reset --hard 'ref'");
|
|
|
|
|
|
+ $expectedGitCommand = $this->getCmd("git clone 'http://github.com/composer/composer' 'composerPath' && cd 'composerPath' && git checkout 'ref' && git reset --hard 'ref' && git remote add composer 'http://github.com/composer/composer'");
|
|
$processExecutor->expects($this->at(2))
|
|
$processExecutor->expects($this->at(2))
|
|
->method('execute')
|
|
->method('execute')
|
|
->with($this->equalTo($expectedGitCommand))
|
|
->with($this->equalTo($expectedGitCommand))
|
|
@@ -104,7 +104,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
*/
|
|
*/
|
|
public function testDownloadThrowsRuntimeExceptionIfGitCommandFails()
|
|
public function testDownloadThrowsRuntimeExceptionIfGitCommandFails()
|
|
{
|
|
{
|
|
- $expectedGitCommand = $this->getCmd("git clone 'https://example.com/composer/composer' 'composerPath' && cd 'composerPath' && git checkout 'ref' && git reset --hard 'ref'");
|
|
|
|
|
|
+ $expectedGitCommand = $this->getCmd("git clone 'https://example.com/composer/composer' 'composerPath' && cd 'composerPath' && git checkout 'ref' && git reset --hard 'ref' && git remote add composer 'https://example.com/composer/composer'");
|
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
|
$packageMock->expects($this->any())
|
|
$packageMock->expects($this->any())
|
|
->method('getSourceReference')
|
|
->method('getSourceReference')
|
|
@@ -139,7 +139,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testUpdate()
|
|
public function testUpdate()
|
|
{
|
|
{
|
|
- $expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url origin 'git://github.com/composer/composer' && git fetch origin && git fetch --tags origin && git checkout 'ref' && git reset --hard 'ref'");
|
|
|
|
|
|
+ $expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url composer 'git://github.com/composer/composer' && git fetch composer && git fetch --tags composer && git checkout 'ref' && git reset --hard 'ref'");
|
|
$expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain");
|
|
$expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain");
|
|
|
|
|
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
|
@@ -168,7 +168,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|
*/
|
|
*/
|
|
public function testUpdateThrowsRuntimeExceptionIfGitCommandFails()
|
|
public function testUpdateThrowsRuntimeExceptionIfGitCommandFails()
|
|
{
|
|
{
|
|
- $expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url origin 'git://github.com/composer/composer' && git fetch origin && git fetch --tags origin && git checkout 'ref' && git reset --hard 'ref'");
|
|
|
|
|
|
+ $expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url composer 'git://github.com/composer/composer' && git fetch composer && git fetch --tags composer && git checkout 'ref' && git reset --hard 'ref'");
|
|
$expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain");
|
|
$expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain");
|
|
|
|
|
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|