mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Remove use of deprecated getMock method
This commit is contained in:
parent
036fc44c25
commit
066351c5b9
42 changed files with 279 additions and 272 deletions
|
@ -60,9 +60,9 @@ class GitDownloaderTest extends TestCase
|
|||
|
||||
protected function getDownloaderMock($io = null, $config = null, $executor = null, $filesystem = null)
|
||||
{
|
||||
$io = $io ?: $this->getMock('Composer\IO\IOInterface');
|
||||
$executor = $executor ?: $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$filesystem = $filesystem ?: $this->getMock('Composer\Util\Filesystem');
|
||||
$io = $io ?: $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
|
||||
$executor = $executor ?: $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
|
||||
$filesystem = $filesystem ?: $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
|
||||
$config = $this->setupConfig($config);
|
||||
|
||||
return new GitDownloader($io, $config, $executor, $filesystem);
|
||||
|
@ -73,7 +73,7 @@ class GitDownloaderTest extends TestCase
|
|||
*/
|
||||
public function testDownloadForPackageWithoutSourceReference()
|
||||
{
|
||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$packageMock->expects($this->once())
|
||||
->method('getSourceReference')
|
||||
->will($this->returnValue(null));
|
||||
|
@ -84,7 +84,7 @@ class GitDownloaderTest extends TestCase
|
|||
|
||||
public function testDownload()
|
||||
{
|
||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceReference')
|
||||
->will($this->returnValue('1234567890123456789012345678901234567890'));
|
||||
|
@ -97,7 +97,7 @@ class GitDownloaderTest extends TestCase
|
|||
$packageMock->expects($this->any())
|
||||
->method('getPrettyVersion')
|
||||
->will($this->returnValue('dev-master'));
|
||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
|
||||
|
||||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
|
@ -135,7 +135,7 @@ class GitDownloaderTest extends TestCase
|
|||
|
||||
public function testDownloadWithCache()
|
||||
{
|
||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceReference')
|
||||
->will($this->returnValue('1234567890123456789012345678901234567890'));
|
||||
|
@ -148,7 +148,7 @@ class GitDownloaderTest extends TestCase
|
|||
$packageMock->expects($this->any())
|
||||
->method('getPrettyVersion')
|
||||
->will($this->returnValue('dev-master'));
|
||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
|
||||
|
||||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
|
@ -201,7 +201,7 @@ class GitDownloaderTest extends TestCase
|
|||
|
||||
public function testDownloadUsesVariousProtocolsAndSetsPushUrlForGithub()
|
||||
{
|
||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceReference')
|
||||
->will($this->returnValue('ref'));
|
||||
|
@ -214,7 +214,7 @@ class GitDownloaderTest extends TestCase
|
|||
$packageMock->expects($this->any())
|
||||
->method('getPrettyVersion')
|
||||
->will($this->returnValue('1.0.0'));
|
||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
|
||||
|
||||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
|
@ -285,7 +285,7 @@ class GitDownloaderTest extends TestCase
|
|||
*/
|
||||
public function testDownloadAndSetPushUrlUseCustomVariousProtocolsForGithub($protocols, $url, $pushUrl)
|
||||
{
|
||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceReference')
|
||||
->will($this->returnValue('ref'));
|
||||
|
@ -298,7 +298,7 @@ class GitDownloaderTest extends TestCase
|
|||
$packageMock->expects($this->any())
|
||||
->method('getPrettyVersion')
|
||||
->will($this->returnValue('1.0.0'));
|
||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
|
||||
|
||||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
|
@ -338,14 +338,14 @@ class GitDownloaderTest extends TestCase
|
|||
public function testDownloadThrowsRuntimeExceptionIfGitCommandFails()
|
||||
{
|
||||
$expectedGitCommand = $this->winCompat("git clone --no-checkout 'https://example.com/composer/composer' 'composerPath' && cd 'composerPath' && git remote add composer 'https://example.com/composer/composer' && git fetch composer");
|
||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceReference')
|
||||
->will($this->returnValue('ref'));
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceUrls')
|
||||
->will($this->returnValue(array('https://example.com/composer/composer')));
|
||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
|
||||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat('git --version')))
|
||||
|
@ -368,8 +368,8 @@ class GitDownloaderTest extends TestCase
|
|||
*/
|
||||
public function testUpdateforPackageWithoutSourceReference()
|
||||
{
|
||||
$initialPackageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$sourcePackageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$initialPackageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$sourcePackageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$sourcePackageMock->expects($this->once())
|
||||
->method('getSourceReference')
|
||||
->will($this->returnValue(null));
|
||||
|
@ -382,7 +382,7 @@ class GitDownloaderTest extends TestCase
|
|||
{
|
||||
$expectedGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref^{commit}' || (git fetch composer && git fetch --tags composer)");
|
||||
|
||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceReference')
|
||||
->will($this->returnValue('ref'));
|
||||
|
@ -392,7 +392,7 @@ class GitDownloaderTest extends TestCase
|
|||
$packageMock->expects($this->any())
|
||||
->method('getPrettyVersion')
|
||||
->will($this->returnValue('1.0.0'));
|
||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
|
||||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat("git show-ref --head -d")))
|
||||
|
@ -431,7 +431,7 @@ class GitDownloaderTest extends TestCase
|
|||
{
|
||||
$expectedGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref^{commit}' || (git fetch composer && git fetch --tags composer)");
|
||||
|
||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceReference')
|
||||
->will($this->returnValue('ref'));
|
||||
|
@ -444,7 +444,7 @@ class GitDownloaderTest extends TestCase
|
|||
$packageMock->expects($this->any())
|
||||
->method('getPrettyVersion')
|
||||
->will($this->returnValue('1.0.0'));
|
||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
|
||||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat("git show-ref --head -d")))
|
||||
|
@ -503,14 +503,14 @@ composer https://github.com/old/url (push)
|
|||
{
|
||||
$expectedGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref^{commit}' || (git fetch composer && git fetch --tags composer)");
|
||||
|
||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceReference')
|
||||
->will($this->returnValue('ref'));
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceUrls')
|
||||
->will($this->returnValue(array('https://github.com/composer/composer')));
|
||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
|
||||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat("git show-ref --head -d")))
|
||||
|
@ -542,14 +542,14 @@ composer https://github.com/old/url (push)
|
|||
$expectedFirstGitUpdateCommand = $this->winCompat("git remote set-url composer '' && git rev-parse --quiet --verify 'ref^{commit}' || (git fetch composer && git fetch --tags composer)");
|
||||
$expectedSecondGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref^{commit}' || (git fetch composer && git fetch --tags composer)");
|
||||
|
||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceReference')
|
||||
->will($this->returnValue('ref'));
|
||||
$packageMock->expects($this->any())
|
||||
->method('getSourceUrls')
|
||||
->will($this->returnValue(array('/foo/bar', 'https://github.com/composer/composer')));
|
||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
|
||||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat("git show-ref --head -d")))
|
||||
|
@ -600,13 +600,13 @@ composer https://github.com/old/url (push)
|
|||
{
|
||||
$expectedGitResetCommand = $this->winCompat("cd 'composerPath' && git status --porcelain --untracked-files=no");
|
||||
|
||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
|
||||
$processExecutor->expects($this->any())
|
||||
->method('execute')
|
||||
->with($this->equalTo($expectedGitResetCommand))
|
||||
->will($this->returnValue(0));
|
||||
$filesystem = $this->getMock('Composer\Util\Filesystem');
|
||||
$filesystem = $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
|
||||
$filesystem->expects($this->any())
|
||||
->method('removeDirectory')
|
||||
->with($this->equalTo('composerPath'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue