1
0
Fork 0

Merge pull request #7399 from theofidry/bugfix/fix-suggest-reporter

Hide suggest reason when there is not one
pull/7427/merge
Jordi Boggiano 2018-06-09 16:21:39 +02:00 committed by GitHub
commit f92e15b032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -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'].')' : '')
));
}

View File

@ -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
*/