diff --git a/src/Composer/Installer/SuggestedPackagesReporter.php b/src/Composer/Installer/SuggestedPackagesReporter.php index ed89ec02b..25788e547 100644 --- a/src/Composer/Installer/SuggestedPackagesReporter.php +++ b/src/Composer/Installer/SuggestedPackagesReporter.php @@ -115,10 +115,10 @@ class SuggestedPackagesReporter } $this->io->writeError(sprintf( - '%s suggests installing %s (%s)', + '%s suggests installing %s%s', $suggestion['source'], $this->escapeOutput($suggestion['target']), - $this->escapeOutput($suggestion['reason']) + $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '') )); } diff --git a/src/Composer/Repository/ArtifactRepository.php b/src/Composer/Repository/ArtifactRepository.php index a8002123a..374f04cea 100644 --- a/src/Composer/Repository/ArtifactRepository.php +++ b/src/Composer/Repository/ArtifactRepository.php @@ -138,6 +138,7 @@ class ArtifactRepository extends ArrayRepository implements ConfigurableReposito } $configurationFileName = $zip->getNameIndex($foundFileIndex); + $zip->close(); $composerFile = "zip://{$file->getPathname()}#$configurationFileName"; $json = file_get_contents($composerFile); diff --git a/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php b/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php index 7c80935cd..6aef0fa7d 100644 --- a/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php +++ b/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php @@ -142,6 +142,20 @@ class SuggestedPackagesReporterTest extends TestCase $this->suggestedPackagesReporter->output(); } + /** + * @covers ::output + */ + public function testOutputWithNoSuggestedPackage() + { + $this->suggestedPackagesReporter->addPackage('a', 'b', ''); + + $this->io->expects($this->once()) + ->method('writeError') + ->with('a suggests installing b'); + + $this->suggestedPackagesReporter->output(); + } + /** * @covers ::output */