Fix show --platform regression failing if no composer.json exists, fixes #11046
parent
9bb436ec28
commit
4164b30236
|
@ -677,7 +677,12 @@ EOT
|
|||
*/
|
||||
protected function getRootRequires(): array
|
||||
{
|
||||
$rootPackage = $this->requireComposer()->getPackage();
|
||||
$composer = $this->tryComposer();
|
||||
if ($composer === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$rootPackage = $composer->getPackage();
|
||||
|
||||
return array_map(
|
||||
'strtolower',
|
||||
|
|
|
@ -192,6 +192,20 @@ outdated/patch 1.0.0 <highlight>! 1.0.1</highlight>',
|
|||
}
|
||||
}
|
||||
|
||||
public function testShowPlatformWorksWithoutComposerJson(): void
|
||||
{
|
||||
$this->initTempComposer([]);
|
||||
unlink('./composer.json');
|
||||
unlink('./auth.json');
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(['command' => 'show', '-p' => true]);
|
||||
$output = trim($appTester->getDisplay(true));
|
||||
foreach (Regex::matchAll('{^(\w+)}m', $output)->matches as $m) {
|
||||
self::assertTrue(PlatformRepository::isPlatformPackage((string) $m[1]));
|
||||
}
|
||||
}
|
||||
|
||||
public function testOutdatedWithZeroMajor(): void
|
||||
{
|
||||
$this->initTempComposer([
|
||||
|
|
Loading…
Reference in New Issue