Skip to content

Commit ac88c70

Browse files
theimbenderalcohol
authored andcommitted
Increase coverage for BuildCommand, fix --no-html-output flag bug
1 parent f0233d3 commit ac88c70

File tree

2 files changed

+656
-19
lines changed

2 files changed

+656
-19
lines changed

src/Console/Command/BuildCommand.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
272272
$packagesBuilder = new PackagesBuilder($output, $outputDir, $config, $skipErrors, $minify);
273273
$packagesBuilder->dump($packages);
274274

275-
$htmlView = (bool) $input->getOption('no-html-output');
276-
if (!$htmlView) {
277-
$htmlView = !isset($config['output-html']) || (bool) $config['output-html'];
278-
}
279-
280-
if ($htmlView) {
275+
if ($this->shouldBuildHtml($input, $config)) {
281276
$web = new WebBuilder($output, $outputDir, $config, $skipErrors);
282277
$web->setRootPackage($composer->getPackage());
283278
$web->dump($packages);
@@ -330,6 +325,22 @@ static function ($repo) use ($disabledRepoNames, &$removedNames): bool {
330325
}
331326
}
332327

328+
/**
329+
* @param array<string, mixed> $config
330+
*/
331+
private function shouldBuildHtml(InputInterface $input, array $config): bool
332+
{
333+
if ((bool) $input->getOption('no-html-output')) {
334+
return false;
335+
}
336+
337+
if (isset($config['output-html'])) {
338+
return (bool) $config['output-html'];
339+
}
340+
341+
return true;
342+
}
343+
333344
private function getConfiguration(): Config
334345
{
335346
$config = new Config();

0 commit comments

Comments
 (0)