Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,27 @@ public function testGetVersionCached()
public static function testGetVersionGitInstallationDataProvider()
{
return [
[
'community edition package' => [
[
0 => [
'name' => 'magento/product-community-edition',
'version' => '123.456.789'
],
1 => [
'name' => 'magento/product-other-edition',
'version' => '987.654.321'
'mage-os/product-community-edition' => [
'name' => 'mage-os/product-community-edition',
'version' => '1.0.0',
'magento_version' => '123.456.789'
],
],
'123.456.789'
],
[
'minimal product package' => [
[
'mage-os/product-minimal' => [
'name' => 'mage-os/product-minimal',
'version' => '2.0.0',
'magento_version' => '234.567.890'
],
],
'234.567.890'
],
'empty packages' => [
[],
'UNKNOWN'
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ public function getRequiredPhpVersion()
foreach ($packages as $package) {
if ($package instanceof CompletePackageInterface) {
$packageName = $package->getPrettyName();
if ($packageName === 'mage-os/product-community-edition') {
if ($this->isSystemPackage($packageName)) {
$phpRequirementLink = $package->getRequires()['php'];
if ($phpRequirementLink instanceof Link) {
$requiredPhpVersion = $phpRequirementLink->getPrettyConstraint();
}
break;
}
}
}
Expand Down Expand Up @@ -262,7 +263,7 @@ public function getSystemPackages()
*/
public function isSystemPackage($packageName = '')
{
if (preg_match('/mage-os\/product-.*?-edition/', $packageName) == 1) {
if (preg_match('/^mage-os\/product-.+/', $packageName) == 1) {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,31 @@ public static function isMagentoRootDataProvider()
['namespace/package', false],
];
}

/**
* @param string $packageName
* @param boolean $expected
* @dataProvider isSystemPackageDataProvider
*/
public function testIsSystemPackage($packageName, $expected)
{
$this->assertEquals($expected, $this->composerInformation->isSystemPackage($packageName));
}

/**
* @return array
*/
public static function isSystemPackageDataProvider()
{
return [
['mage-os/product-community-edition', true],
['mage-os/product-enterprise-edition', true],
['mage-os/product-minimal', true],
['mage-os/product-custom-build', true],
['magento/product-community-edition', false],
['mage-os/module-something', false],
['namespace/package', false],
['mage-os/product-', false],
];
}
}
Loading