Fix tests
parent
da5ee6e2d7
commit
b641f9ea68
|
@ -209,7 +209,6 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testUpdate()
|
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");
|
$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 = $this->getMock('Composer\Package\PackageInterface');
|
||||||
$packageMock->expects($this->any())
|
$packageMock->expects($this->any())
|
||||||
|
@ -224,21 +223,17 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||||
$processExecutor->expects($this->at(0))
|
$processExecutor->expects($this->at(0))
|
||||||
->method('execute')
|
->method('execute')
|
||||||
->with($this->equalTo($expectedGitResetCommand))
|
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v")))
|
||||||
->will($this->returnValue(0));
|
->will($this->returnValue(0));
|
||||||
$processExecutor->expects($this->at(1))
|
$processExecutor->expects($this->at(1))
|
||||||
->method('execute')
|
->method('execute')
|
||||||
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v")))
|
->with($this->equalTo($expectedGitUpdateCommand))
|
||||||
->will($this->returnValue(0));
|
->will($this->returnValue(0));
|
||||||
$processExecutor->expects($this->at(2))
|
$processExecutor->expects($this->at(2))
|
||||||
->method('execute')
|
|
||||||
->with($this->equalTo($expectedGitUpdateCommand))
|
|
||||||
->will($this->returnValue(0));
|
|
||||||
$processExecutor->expects($this->at(3))
|
|
||||||
->method('execute')
|
->method('execute')
|
||||||
->with($this->equalTo('git branch -r'))
|
->with($this->equalTo('git branch -r'))
|
||||||
->will($this->returnValue(0));
|
->will($this->returnValue(0));
|
||||||
$processExecutor->expects($this->at(4))
|
$processExecutor->expects($this->at(3))
|
||||||
->method('execute')
|
->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 'ref' && git reset --hard 'ref'")), $this->equalTo(null), $this->equalTo('composerPath'))
|
||||||
->will($this->returnValue(0));
|
->will($this->returnValue(0));
|
||||||
|
@ -253,7 +248,6 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testUpdateThrowsRuntimeExceptionIfGitCommandFails()
|
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");
|
$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 = $this->getMock('Composer\Package\PackageInterface');
|
||||||
$packageMock->expects($this->any())
|
$packageMock->expects($this->any())
|
||||||
|
@ -264,14 +258,10 @@ 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');
|
||||||
$processExecutor->expects($this->at(0))
|
$processExecutor->expects($this->at(0))
|
||||||
->method('execute')
|
|
||||||
->with($this->equalTo($expectedGitResetCommand))
|
|
||||||
->will($this->returnValue(0));
|
|
||||||
$processExecutor->expects($this->at(1))
|
|
||||||
->method('execute')
|
->method('execute')
|
||||||
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v")))
|
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v")))
|
||||||
->will($this->returnValue(0));
|
->will($this->returnValue(0));
|
||||||
$processExecutor->expects($this->at(2))
|
$processExecutor->expects($this->at(1))
|
||||||
->method('execute')
|
->method('execute')
|
||||||
->with($this->equalTo($expectedGitUpdateCommand))
|
->with($this->equalTo($expectedGitUpdateCommand))
|
||||||
->will($this->returnValue(1));
|
->will($this->returnValue(1));
|
||||||
|
|
|
@ -78,7 +78,6 @@ class HgDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testUpdate()
|
public function testUpdate()
|
||||||
{
|
{
|
||||||
$expectedUpdateCommand = $this->getCmd("cd 'composerPath' && hg pull 'https://github.com/l3l0/composer' && hg up 'ref'");
|
$expectedUpdateCommand = $this->getCmd("cd 'composerPath' && hg pull 'https://github.com/l3l0/composer' && hg up 'ref'");
|
||||||
$expectedResetCommand = $this->getCmd("cd 'composerPath' && hg st");
|
|
||||||
|
|
||||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||||
$packageMock->expects($this->any())
|
$packageMock->expects($this->any())
|
||||||
|
@ -89,9 +88,6 @@ class HgDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
->will($this->returnValue('https://github.com/l3l0/composer'));
|
->will($this->returnValue('https://github.com/l3l0/composer'));
|
||||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||||
$processExecutor->expects($this->at(0))
|
$processExecutor->expects($this->at(0))
|
||||||
->method('execute')
|
|
||||||
->with($this->equalTo($expectedResetCommand));
|
|
||||||
$processExecutor->expects($this->at(1))
|
|
||||||
->method('execute')
|
->method('execute')
|
||||||
->with($this->equalTo($expectedUpdateCommand))
|
->with($this->equalTo($expectedUpdateCommand))
|
||||||
->will($this->returnValue(0));
|
->will($this->returnValue(0));
|
||||||
|
|
Loading…
Reference in New Issue