From 19878c2dc10143de20391b805df26a1ca922168b Mon Sep 17 00:00:00 2001 From: Leszek Prabucki Date: Mon, 23 Jan 2012 08:40:34 +0100 Subject: [PATCH] Fixed tests after update and merge of changes from upstream/master --- .../Test/Downloader/GitDownloaderTest.php | 20 +++++++------- .../Test/Downloader/HgDownloaderTest.php | 26 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/Composer/Test/Downloader/GitDownloaderTest.php b/tests/Composer/Test/Downloader/GitDownloaderTest.php index 57cbd945d..7d563d2e4 100644 --- a/tests/Composer/Test/Downloader/GitDownloaderTest.php +++ b/tests/Composer/Test/Downloader/GitDownloaderTest.php @@ -26,13 +26,13 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase ->method('getSourceReference') ->will($this->returnValue(null)); - $downloader = new GitDownloader(); + $downloader = new GitDownloader($this->getMock('Composer\IO\IOInterface')); $downloader->download($packageMock, '/path'); } public function testDownload() { - $expectedGitCommand = 'git clone \'https://github.com/l3l0/composer\' composerPath && cd composerPath && git checkout \'ref\' && git reset --hard \'ref\''; + $expectedGitCommand = 'git clone \'https://github.com/l3l0/composer\' \'composerPath\' && cd \'composerPath\' && git checkout \'ref\' && git reset --hard \'ref\''; $packageMock = $this->getMock('Composer\Package\PackageInterface'); $packageMock->expects($this->any()) ->method('getSourceReference') @@ -45,7 +45,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase ->method('execute') ->with($this->equalTo($expectedGitCommand)); - $downloader = new GitDownloader($processExecutor); + $downloader = new GitDownloader($this->getMock('Composer\IO\IOInterface'), $processExecutor); $downloader->download($packageMock, 'composerPath'); } @@ -60,14 +60,14 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase ->method('getSourceReference') ->will($this->returnValue(null)); - $downloader = new GitDownloader(); + $downloader = new GitDownloader($this->getMock('Composer\IO\IOInterface')); $downloader->update($initialPackageMock, $sourcePackageMock, '/path'); } public function testUpdate() { - $expectedGitUpdateCommand = 'cd composerPath && git fetch && git checkout ref && git reset --hard ref'; - $expectedGitResetCommand = 'cd composerPath && git status --porcelain'; + $expectedGitUpdateCommand = 'cd \'composerPath\' && git fetch && git checkout \'ref\' && git reset --hard \'ref\''; + $expectedGitResetCommand = 'cd \'composerPath\' && git status --porcelain'; $packageMock = $this->getMock('Composer\Package\PackageInterface'); $packageMock->expects($this->any()) @@ -84,13 +84,13 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase ->method('execute') ->with($this->equalTo($expectedGitUpdateCommand)); - $downloader = new GitDownloader($processExecutor); + $downloader = new GitDownloader($this->getMock('Composer\IO\IOInterface'), $processExecutor); $downloader->update($packageMock, $packageMock, 'composerPath'); } public function testRemove() { - $expectedGitResetCommand = 'cd composerPath && git status --porcelain'; + $expectedGitResetCommand = 'cd \'composerPath\' && git status --porcelain'; $packageMock = $this->getMock('Composer\Package\PackageInterface'); $processExecutor = $this->getMock('Composer\Util\ProcessExecutor'); @@ -98,13 +98,13 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase ->method('execute') ->with($this->equalTo($expectedGitResetCommand)); - $downloader = new GitDownloader($processExecutor); + $downloader = new GitDownloader($this->getMock('Composer\IO\IOInterface'), $processExecutor); $downloader->remove($packageMock, 'composerPath'); } public function testGetInstallationSource() { - $downloader = new GitDownloader(); + $downloader = new GitDownloader($this->getMock('Composer\IO\IOInterface')); $this->assertEquals('source', $downloader->getInstallationSource()); } diff --git a/tests/Composer/Test/Downloader/HgDownloaderTest.php b/tests/Composer/Test/Downloader/HgDownloaderTest.php index d6752eb4a..81429194d 100644 --- a/tests/Composer/Test/Downloader/HgDownloaderTest.php +++ b/tests/Composer/Test/Downloader/HgDownloaderTest.php @@ -26,13 +26,13 @@ class HgDownloaderTest extends \PHPUnit_Framework_TestCase ->method('getSourceReference') ->will($this->returnValue(null)); - $downloader = new HgDownloader(); + $downloader = new HgDownloader($this->getMock('Composer\IO\IOInterface')); $downloader->download($packageMock, '/path'); } public function testDownload() { - $expectedGitCommand = '(hg clone \'https://mercurial.dev/l3l0/composer\' composerPath 2> /dev/null) && cd composerPath && hg up \'ref\''; + $expectedGitCommand = 'hg clone \'https://mercurial.dev/l3l0/composer\' \'composerPath\' && cd \'composerPath\' && hg up \'ref\''; $packageMock = $this->getMock('Composer\Package\PackageInterface'); $packageMock->expects($this->any()) ->method('getSourceReference') @@ -45,7 +45,7 @@ class HgDownloaderTest extends \PHPUnit_Framework_TestCase ->method('execute') ->with($this->equalTo($expectedGitCommand)); - $downloader = new HgDownloader($processExecutor); + $downloader = new HgDownloader($this->getMock('Composer\IO\IOInterface'), $processExecutor); $downloader->download($packageMock, 'composerPath'); } @@ -60,14 +60,14 @@ class HgDownloaderTest extends \PHPUnit_Framework_TestCase ->method('getSourceReference') ->will($this->returnValue(null)); - $downloader = new HgDownloader(); + $downloader = new HgDownloader($this->getMock('Composer\IO\IOInterface')); $downloader->update($initialPackageMock, $sourcePackageMock, '/path'); } public function testUpdate() { - $expectedGitUpdateCommand = 'cd composerPath && hg pull && hg up \'ref\''; - $expectedGitResetCommand = 'cd composerPath && hg st'; + $expectedUpdateCommand = 'cd \'composerPath\' && hg pull && hg up \'ref\''; + $expectedResetCommand = 'cd \'composerPath\' && hg st'; $packageMock = $this->getMock('Composer\Package\PackageInterface'); $packageMock->expects($this->any()) @@ -79,32 +79,32 @@ class HgDownloaderTest extends \PHPUnit_Framework_TestCase $processExecutor = $this->getMock('Composer\Util\ProcessExecutor'); $processExecutor->expects($this->at(0)) ->method('execute') - ->with($this->equalTo($expectedGitResetCommand)); + ->with($this->equalTo($expectedResetCommand)); $processExecutor->expects($this->at(1)) ->method('execute') - ->with($this->equalTo($expectedGitUpdateCommand)); + ->with($this->equalTo($expectedUpdateCommand)); - $downloader = new HgDownloader($processExecutor); + $downloader = new HgDownloader($this->getMock('Composer\IO\IOInterface'), $processExecutor); $downloader->update($packageMock, $packageMock, 'composerPath'); } public function testRemove() { - $expectedGitResetCommand = 'cd composerPath && hg st'; + $expectedResetCommand = 'cd \'composerPath\' && hg st'; $packageMock = $this->getMock('Composer\Package\PackageInterface'); $processExecutor = $this->getMock('Composer\Util\ProcessExecutor'); $processExecutor->expects($this->any()) ->method('execute') - ->with($this->equalTo($expectedGitResetCommand)); + ->with($this->equalTo($expectedResetCommand)); - $downloader = new HgDownloader($processExecutor); + $downloader = new HgDownloader($this->getMock('Composer\IO\IOInterface'), $processExecutor); $downloader->remove($packageMock, 'composerPath'); } public function testGetInstallationSource() { - $downloader = new HgDownloader(); + $downloader = new HgDownloader($this->getMock('Composer\IO\IOInterface')); $this->assertEquals('source', $downloader->getInstallationSource()); }