Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display "composer why" suggestion for every package #4406

Merged
merged 5 commits into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Commands/pm/SecurityUpdateCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function securityPhp($options = ['format' => 'yaml'])
$process->mustRun();
$out = $process->getOutput();
if ($packages = json_decode($out, true)) {
$suggested_command = "composer why " . key($packages);
$suggested_command = "composer why " . implode(' && composer why ', array_keys($packages));
$this->logger()->warning('One or more of your dependencies has an outstanding security update.');
$this->logger()->notice("Run <comment>$suggested_command</comment> to learn what module requires the package.");
return CommandResult::dataWithExitCode(new UnstructuredData($packages), self::EXIT_FAILURE);
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/SecurityUpdatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testInsecurePhpPackage()
{
$this->drush('pm:security-php', [], ['format' => 'json'], self::EXIT_ERROR);
$this->assertContains('One or more of your dependencies has an outstanding security update.', $this->getErrorOutput());
$this->assertContains('Run composer why david-garcia/phpwhois to learn what module requires the package.', $this->getErrorOutput());
$this->assertContains('Run composer why david-garcia/phpwhois', $this->getErrorOutput());
$security_advisories = $this->getOutputFromJSON();
$this->arrayHasKey('david-garcia/phpwhois', $security_advisories);
}
Expand Down