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

@ -22,22 +22,22 @@ class MetadataMinifierTest extends TestCase
public function testMinifyExpand(): void
{
$package1 = new CompletePackage('foo/bar', '2.0.0.0', '2.0.0');
$package1->setScripts(array('foo' => array('bar')));
$package1->setLicense(array('MIT'));
$package1->setScripts(['foo' => ['bar']]);
$package1->setLicense(['MIT']);
$package2 = new CompletePackage('foo/bar', '1.2.0.0', '1.2.0');
$package2->setLicense(array('GPL'));
$package2->setLicense(['GPL']);
$package2->setHomepage('https://example.org');
$package3 = new CompletePackage('foo/bar', '1.0.0.0', '1.0.0');
$package3->setLicense(array('GPL'));
$package3->setLicense(['GPL']);
$dumper = new ArrayDumper();
$minified = array(
array('name' => 'foo/bar', 'version' => '2.0.0', 'version_normalized' => '2.0.0.0', 'type' => 'library', 'scripts' => array('foo' => array('bar')), 'license' => array('MIT')),
array('version' => '1.2.0', 'version_normalized' => '1.2.0.0', 'license' => array('GPL'), 'homepage' => 'https://example.org', 'scripts' => '__unset'),
array('version' => '1.0.0', 'version_normalized' => '1.0.0.0', 'homepage' => '__unset'),
);
$minified = [
['name' => 'foo/bar', 'version' => '2.0.0', 'version_normalized' => '2.0.0.0', 'type' => 'library', 'scripts' => ['foo' => ['bar']], 'license' => ['MIT']],
['version' => '1.2.0', 'version_normalized' => '1.2.0.0', 'license' => ['GPL'], 'homepage' => 'https://example.org', 'scripts' => '__unset'],
['version' => '1.0.0', 'version_normalized' => '1.0.0.0', 'homepage' => '__unset'],
];
$source = array($dumper->dump($package1), $dumper->dump($package2), $dumper->dump($package3));
$source = [$dumper->dump($package1), $dumper->dump($package2), $dumper->dump($package3)];
$this->assertSame($minified, MetadataMinifier::minify($source));
$this->assertSame($source, MetadataMinifier::expand($minified));