1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +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

@ -13,7 +13,6 @@
namespace Composer\Test\Repository;
use Composer\Package\RootPackageInterface;
use Composer\Package\RootAliasPackage;
use Composer\Repository\FilesystemRepository;
use Composer\Test\TestCase;
use Composer\Json\JsonFile;
@ -30,9 +29,9 @@ class FilesystemRepositoryTest extends TestCase
$json
->expects($this->once())
->method('read')
->will($this->returnValue(array(
array('name' => 'package1', 'version' => '1.0.0-beta', 'type' => 'vendor'),
)));
->will($this->returnValue([
['name' => 'package1', 'version' => '1.0.0-beta', 'type' => 'vendor'],
]));
$json
->expects($this->once())
->method('exists')
@ -76,7 +75,7 @@ class FilesystemRepositoryTest extends TestCase
->method('exists')
->will($this->returnValue(false));
$this->assertEquals(array(), $repository->getPackages());
$this->assertEquals([], $repository->getPackages());
}
public function testRepositoryWrite(): void
@ -98,7 +97,7 @@ class FilesystemRepositoryTest extends TestCase
$json
->expects($this->once())
->method('read')
->will($this->returnValue(array()));
->will($this->returnValue([]));
$json
->expects($this->once())
->method('getPath')
@ -110,16 +109,16 @@ class FilesystemRepositoryTest extends TestCase
$json
->expects($this->once())
->method('write')
->with(array(
'packages' => array(
array('name' => 'mypkg', 'type' => 'library', 'version' => '0.1.10', 'version_normalized' => '0.1.10.0', 'install-path' => '../woop/woop'),
array('name' => 'mypkg2', 'type' => 'library', 'version' => '1.2.3', 'version_normalized' => '1.2.3.0', 'install-path' => '../woop/woop'),
),
->with([
'packages' => [
['name' => 'mypkg', 'type' => 'library', 'version' => '0.1.10', 'version_normalized' => '0.1.10.0', 'install-path' => '../woop/woop'],
['name' => 'mypkg2', 'type' => 'library', 'version' => '1.2.3', 'version_normalized' => '1.2.3.0', 'install-path' => '../woop/woop'],
],
'dev' => true,
'dev-package-names' => array('mypkg2'),
));
'dev-package-names' => ['mypkg2'],
]);
$repository->setDevPackageNames(array('mypkg2'));
$repository->setDevPackageNames(['mypkg2']);
$repository->addPackage($this->getPackage('mypkg2', '1.2.3'));
$repository->addPackage($this->getPackage('mypkg', '0.1.10'));
$repository->write(true, $im);
@ -135,18 +134,18 @@ class FilesystemRepositoryTest extends TestCase
$rootPackage = $this->getRootPackage('__root__', 'dev-master');
$rootPackage->setSourceReference('sourceref-by-default');
$rootPackage->setDistReference('distref');
$this->configureLinks($rootPackage, array('provide' => array('foo/impl' => '2.0')));
$this->configureLinks($rootPackage, ['provide' => ['foo/impl' => '2.0']]);
$rootPackage = $this->getAliasPackage($rootPackage, '1.10.x-dev');
$repository = new FilesystemRepository($json, true, $rootPackage);
$repository->setDevPackageNames(array('c/c'));
$repository->setDevPackageNames(['c/c']);
$pkg = $this->getPackage('a/provider', '1.1');
$this->configureLinks($pkg, array('provide' => array('foo/impl' => '^1.1', 'foo/impl2' => '2.0')));
$this->configureLinks($pkg, ['provide' => ['foo/impl' => '^1.1', 'foo/impl2' => '2.0']]);
$pkg->setDistReference('distref-as-no-source');
$repository->addPackage($pkg);
$pkg = $this->getPackage('a/provider2', '1.2');
$this->configureLinks($pkg, array('provide' => array('foo/impl' => 'self.version', 'foo/impl2' => '2.0')));
$this->configureLinks($pkg, ['provide' => ['foo/impl' => 'self.version', 'foo/impl2' => '2.0']]);
$pkg->setSourceReference('sourceref');
$pkg->setDistReference('distref-as-installed-from-dist');
$pkg->setInstallationSource('dist');
@ -155,7 +154,7 @@ class FilesystemRepositoryTest extends TestCase
$repository->addPackage($this->getAliasPackage($pkg, '1.4'));
$pkg = $this->getPackage('b/replacer', '2.2');
$this->configureLinks($pkg, array('replace' => array('foo/impl2' => 'self.version', 'foo/replaced' => '^3.0')));
$this->configureLinks($pkg, ['replace' => ['foo/impl2' => 'self.version', 'foo/replaced' => '^3.0']]);
$repository->addPackage($pkg);
$pkg = $this->getPackage('c/c', '3.0');
@ -170,7 +169,7 @@ class FilesystemRepositoryTest extends TestCase
->getMock();
$im->expects($this->any())
->method('getInstallPath')
->will($this->returnCallback(function ($package) use ($dir): string {
->will($this->returnCallback(static function ($package) use ($dir): string {
// check for empty paths handling
if ($package->getType() === 'metapackage') {
return '';