Skip to content

Commit 5ed82d4

Browse files
[TASK] Add "--minimal-test" CLI option (#765)
This allows us to control specific settings needed for mininmal tests (like setting only a single output format) or more for the future. Closes #764 --------- Co-authored-by: lina.wolf <[email protected]>
1 parent 9cf7b06 commit 5ed82d4

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ test: test-integration test-unit test-xml test-docs test-rendertest ## Runs all
124124
.PHONY: test-docs
125125
test-docs: ## Runs project generation tests
126126
@echo "$(ENV_INFO)"
127-
$(PHP_BIN) vendor/bin/guides --no-progress Documentation --output="/tmp/test" --config=Documentation --fail-on-log
127+
$(PHP_BIN) vendor/bin/guides --no-progress Documentation --output="/tmp/test" --config=Documentation --minimal-test
128128

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

134134
.PHONY: rendertest
135135
rendertest: ## Runs rendering with Documentation-rendertest

packages/typo3-docs-theme/src/EventListeners/AddThemeSettingsToProjectNode.php

+14
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ public function __construct(
1717
public function __invoke(PostProjectNodeCreated $event): void
1818
{
1919
$projectNode = $event->getProjectNode();
20+
21+
// Native parsing of argv because we do not have the original ArgvInput
22+
// available, and neither the InputDefinition. That's ok for the
23+
// very basic parsing of a global option.
24+
if (in_array('--minimal-test', $_SERVER['argv'] ?? [], true)) {
25+
$settings = $event->getSettings();
26+
27+
// Set up input arguments for our minimal test. Will override
28+
// other input arguments. Can be extended later, so we have
29+
// control also in the further command flow.
30+
$settings->setOutputFormats(['singlepage']);
31+
$settings->setFailOnError('warning'); // 'error' for "no warnings"
32+
}
33+
2034
foreach ($this->themeSettings->getAllSettings() as $key => $setting) {
2135
if (trim($setting) !== '') {
2236
$projectNode->addVariable($key, new PlainTextInlineNode($setting));

packages/typo3-guides-extension/src/Command/RunDecorator.php

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Symfony\Component\Console\Input\InputArgument;
1010
use Symfony\Component\Console\Input\InputDefinition;
1111
use Symfony\Component\Console\Input\InputInterface;
12+
use Symfony\Component\Console\Input\InputOption;
1213
use Symfony\Component\Console\Output\OutputInterface;
1314
use Symfony\Component\Finder\Finder;
1415
use Symfony\Component\Process\Process;
@@ -48,6 +49,14 @@ public function __construct(Run $innerCommand, private readonly Typo3DocsInputSe
4849
'Render a specific localization (for example "de_DE", "ru_RU", ...)',
4950
);
5051

52+
// This option is evaluated in the PostProjectNodeCreated event in packages/typo3-docs-theme/src/EventListeners/AddThemeSettingsToProjectNode.php
53+
$this->innerCommand->addOption(
54+
'minimal-test',
55+
null,
56+
InputOption::VALUE_NONE,
57+
'Apply preset for minimal testing (format=singlepage)',
58+
);
59+
5160
}
5261

5362
protected function execute(InputInterface $input, OutputInterface $output): int

0 commit comments

Comments
 (0)