1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 08:32:56 +00:00
This commit is contained in:
Jordi Boggiano 2022-08-17 15:20:07 +03:00 committed by GitHub
parent 6e205a0c84
commit 131da999ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
357 changed files with 5943 additions and 9174 deletions

View file

@ -82,20 +82,18 @@ class PerforceDownloaderTest extends TestCase
*/
protected function getRepoConfig(): array
{
return array('url' => 'TEST_URL', 'p4user' => 'TEST_USER');
return ['url' => 'TEST_URL', 'p4user' => 'TEST_USER'];
}
/**
* @param string[] $repoConfig
* @param \Composer\IO\IOInterface $io
* @param \Composer\Config $config
* @return \Composer\Repository\VcsRepository&\PHPUnit\Framework\MockObject\MockObject
*/
protected function getMockRepository(array $repoConfig, IOInterface $io, Config $config)
{
$repository = $this->getMockBuilder('Composer\Repository\VcsRepository')
->onlyMethods(array('getRepoConfig'))
->setConstructorArgs(array($repoConfig, $io, $config, Factory::createHttpDownloader($io, $config)))
->onlyMethods(['getRepoConfig'])
->setConstructorArgs([$repoConfig, $io, $config, Factory::createHttpDownloader($io, $config)])
->getMock();
$repository->expects($this->any())->method('getRepoConfig')->will($this->returnValue($repoConfig));
@ -129,7 +127,7 @@ class PerforceDownloaderTest extends TestCase
$label = 123;
$this->package->expects($this->once())->method('getSourceReference')->will($this->returnValue($ref));
$this->io->expects($this->once())->method('writeError')->with($this->stringContains('Cloning '.$ref));
$perforceMethods = array('setStream', 'p4Login', 'writeP4ClientSpec', 'connectClient', 'syncCodeBase', 'cleanupClientSpec');
$perforceMethods = ['setStream', 'p4Login', 'writeP4ClientSpec', 'connectClient', 'syncCodeBase', 'cleanupClientSpec'];
$perforce = $this->getMockBuilder('Composer\Util\Perforce')->disableOriginalConstructor()->getMock();
$perforce->expects($this->once())->method('initializePath')->with($this->equalTo($this->testPath));
$perforce->expects($this->once())->method('setStream')->with($this->equalTo($ref));
@ -152,7 +150,7 @@ class PerforceDownloaderTest extends TestCase
$label = null;
$this->package->expects($this->once())->method('getSourceReference')->will($this->returnValue($ref));
$this->io->expects($this->once())->method('writeError')->with($this->stringContains('Cloning '.$ref));
$perforceMethods = array('setStream', 'p4Login', 'writeP4ClientSpec', 'connectClient', 'syncCodeBase', 'cleanupClientSpec');
$perforceMethods = ['setStream', 'p4Login', 'writeP4ClientSpec', 'connectClient', 'syncCodeBase', 'cleanupClientSpec'];
$perforce = $this->getMockBuilder('Composer\Util\Perforce')->disableOriginalConstructor()->getMock();
$perforce->expects($this->once())->method('initializePath')->with($this->equalTo($this->testPath));
$perforce->expects($this->once())->method('setStream')->with($this->equalTo($ref));