1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 16:42:57 +00:00

Fix 'composer show --platform <package>' erroring if no composer.json is present (#11533)

Sort of related to #11046 (although this is not a regression, but didn't work before, either)
This commit is contained in:
David Zülke 2023-07-21 11:28:36 +02:00 committed by GitHub
parent 9eb9e0dcb3
commit 07f706e57d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -288,12 +288,19 @@ vendor/package 1.1.0 <highlight>! 1.2.0</highlight>", trim($appTester->getDispla
unlink('./composer.json');
unlink('./auth.json');
// listing packages
$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]));
}
// getting a single package
$appTester->run(['command' => 'show', '-p' => true, 'package' => 'php']);
$appTester->assertCommandIsSuccessful();
$appTester->run(['command' => 'show', '-p' => true, '-f' => 'json', 'package' => 'php']);
$appTester->assertCommandIsSuccessful();
}
public function testOutdatedWithZeroMajor(): void