1
0
Fork 0

Fix handling for double-zero prefix, refs #11032

pull/11043/head
Jordi Boggiano 2022-08-31 09:47:59 +02:00
parent 2d48c7dbb0
commit 3177b21324
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 7 additions and 2 deletions

View File

@ -1356,7 +1356,7 @@ EOT
} }
if ($targetVersion === null) { if ($targetVersion === null) {
if ($majorOnly && Preg::isMatch('{^(?P<zero_major>0\.)?(?P<first_meaningful>\d+)\.}', $package->getVersion(), $match)) { if ($majorOnly && Preg::isMatch('{^(?P<zero_major>(?:0\.)+)?(?P<first_meaningful>\d+)\.}', $package->getVersion(), $match)) {
$targetVersion = '>='.$match['zero_major'].($match['first_meaningful'] + 1).',<9999999-dev'; $targetVersion = '>='.$match['zero_major'].($match['first_meaningful'] + 1).',<9999999-dev';
} }

View File

@ -199,6 +199,8 @@ outdated/patch 1.0.0 <highlight>! 1.0.1</highlight>',
'packages' => [ 'packages' => [
'type' => 'package', 'type' => 'package',
'package' => [ 'package' => [
['name' => 'zerozero/major', 'description' => 'generic description', 'version' => '0.0.1'],
['name' => 'zerozero/major', 'description' => 'generic description', 'version' => '0.0.2'],
['name' => 'zero/major', 'description' => 'generic description', 'version' => '0.1.0'], ['name' => 'zero/major', 'description' => 'generic description', 'version' => '0.1.0'],
['name' => 'zero/major', 'description' => 'generic description', 'version' => '0.2.0'], ['name' => 'zero/major', 'description' => 'generic description', 'version' => '0.2.0'],
['name' => 'zero/minor', 'description' => 'generic description', 'version' => '0.1.0'], ['name' => 'zero/minor', 'description' => 'generic description', 'version' => '0.1.0'],
@ -209,6 +211,7 @@ outdated/patch 1.0.0 <highlight>! 1.0.1</highlight>',
], ],
], ],
'require' => [ 'require' => [
'zerozero/major' => '^0.0.1',
'zero/major' => '^0.1', 'zero/major' => '^0.1',
'zero/minor' => '^0.1', 'zero/minor' => '^0.1',
'zero/patch' => '^0.1', 'zero/patch' => '^0.1',
@ -216,6 +219,7 @@ outdated/patch 1.0.0 <highlight>! 1.0.1</highlight>',
]); ]);
$this->createInstalledJson([ $this->createInstalledJson([
$this->getPackage('zerozero/major', '0.0.1'),
$this->getPackage('zero/major', '0.1.0'), $this->getPackage('zero/major', '0.1.0'),
$this->getPackage('zero/minor', '0.1.0'), $this->getPackage('zero/minor', '0.1.0'),
$this->getPackage('zero/patch', '0.1.2'), $this->getPackage('zero/patch', '0.1.2'),
@ -244,7 +248,8 @@ zero/patch 0.1.2 <highlight>! 0.1.2.1</highlight>', trim($appTester->getDisplay(
'Legend: 'Legend:
! patch or minor release available - update recommended ! patch or minor release available - update recommended
~ major release available - update possible ~ major release available - update possible
zero/major 0.1.0 ~ 0.2.0', trim($appTester->getDisplay(true))); zero/major 0.1.0 ~ 0.2.0
zerozero/major 0.0.1 ~ 0.0.2', trim($appTester->getDisplay(true)));
} }
public function testShowAllShowsAllSections(): void public function testShowAllShowsAllSections(): void