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

[TASK] Add "--minimal-test" CLI option #765

Merged
merged 4 commits into from
Oct 1, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ test: test-integration test-unit test-xml test-docs test-rendertest ## Runs all
.PHONY: test-docs
test-docs: ## Runs project generation tests
@echo "$(ENV_INFO)"
$(PHP_BIN) vendor/bin/guides --no-progress Documentation --output="/tmp/test" --config=Documentation --fail-on-log
$(PHP_BIN) vendor/bin/guides --no-progress Documentation --output="/tmp/test" --config=Documentation --minimal-test

.PHONY: test-rendertest
test-rendertest: ## Runs rendering with Documentation-rendertest
@echo "$(ENV_INFO)"
$(PHP_BIN) vendor/bin/guides --no-progress Documentation-rendertest --output="Documentation-GENERATED-rendertest" --config=Documentation-rendertest --fail-on-log
$(PHP_BIN) vendor/bin/guides --no-progress Documentation-rendertest --output="Documentation-GENERATED-rendertest" --config=Documentation-rendertest --minimal-test

.PHONY: rendertest
rendertest: ## Runs rendering with Documentation-rendertest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ public function __construct(
public function __invoke(PostProjectNodeCreated $event): void
{
$projectNode = $event->getProjectNode();

// Native parsing of argv because we do not have the original ArgvInput
// available, and neither the InputDefinition. That's ok for the
// very basic parsing of a global option.
if (in_array('--minimal-test', $_SERVER['argv'] ?? [], true)) {
$settings = $event->getSettings();

// Set up input arguments for our minimal test. Will override
// other input arguments. Can be extended later, so we have
// control also in the further command flow.
$settings->setOutputFormats(['singlepage']);
$settings->setFailOnError('warning'); // 'error' for "no warnings"
}

foreach ($this->themeSettings->getAllSettings() as $key => $setting) {
if (trim($setting) !== '') {
$projectNode->addVariable($key, new PlainTextInlineNode($setting));
Expand Down
9 changes: 9 additions & 0 deletions packages/typo3-guides-extension/src/Command/RunDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Process\Process;
Expand Down Expand Up @@ -48,6 +49,14 @@ public function __construct(Run $innerCommand, private readonly Typo3DocsInputSe
'Render a specific localization (for example "de_DE", "ru_RU", ...)',
);

// This option is evaluated in the PostProjectNodeCreated event in packages/typo3-docs-theme/src/EventListeners/AddThemeSettingsToProjectNode.php
$this->innerCommand->addOption(
'minimal-test',
null,
InputOption::VALUE_NONE,
'Apply preset for minimal testing (format=singlepage)',
);

}

protected function execute(InputInterface $input, OutputInterface $output): int
Expand Down
Loading