diff --git a/.github/workflows/TestTugboat.yml b/.github/workflows/TestTugboat.yml index d3d7c5dc..c1c6edaf 100644 --- a/.github/workflows/TestTugboat.yml +++ b/.github/workflows/TestTugboat.yml @@ -53,6 +53,7 @@ jobs: echo " - foo" >> .tugboat/config.drainpipe-override.yml echo " urls:" >> .tugboat/config.drainpipe-override.yml echo " - /" >> .tugboat/config.drainpipe-override.yml + echo " - /?foo=bar" >> .tugboat/config.drainpipe-override.yml echo " screenshot:" >> .tugboat/config.drainpipe-override.yml echo " timeout: 45" >> .tugboat/config.drainpipe-override.yml echo " visualdiff:" >> .tugboat/config.drainpipe-override.yml diff --git a/.tugboat/config.drainpipe-override.yml b/.tugboat/config.drainpipe-override.yml index d1d30e76..1728e40d 100644 --- a/.tugboat/config.drainpipe-override.yml +++ b/.tugboat/config.drainpipe-override.yml @@ -3,6 +3,7 @@ php: - foo urls: - / + - /?foo=bar screenshot: timeout: 45 visualdiff: diff --git a/.tugboat/config.yml b/.tugboat/config.yml index b6c05141..e5aedcf5 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -28,6 +28,7 @@ services: - foo urls: - / + - /?foo=bar screenshot: timeout: 45 visualdiff: diff --git a/src/ScaffoldInstallerPlugin.php b/src/ScaffoldInstallerPlugin.php index 21b5b2ef..5763bc69 100644 --- a/src/ScaffoldInstallerPlugin.php +++ b/src/ScaffoldInstallerPlugin.php @@ -410,15 +410,32 @@ private function installTugboat(string $scaffoldPath): void { $tugboatConfigOverride['php'] = array_filter($tugboatConfigOverride['php'], function($key) { return in_array($key, - ['aliases', 'urls', 'visualdiff', 'screenshot']); - }, - ARRAY_FILTER_USE_KEY); + ['aliases', 'urls', 'visualdiff', 'screenshot'] + ); + }, ARRAY_FILTER_USE_KEY); + + // Prepare YAML data with custom handling for URLs. + $yamlData = []; + foreach ($tugboatConfigOverride['php'] as $key => $value) { + if ($key === 'urls' && is_array($value)) { + // Ensure URLs are added without encoding. + $yamlData[$key] = $value; + } else { + $yamlData[$key] = $value; + } + } + + // Convert the array to a YAML string. + $yamlString = Yaml::dump($yamlData, 2, 2); + + // Indent the YAML string for formatting. $overrideOutput = []; - foreach (explode(PHP_EOL, - Yaml::dump($tugboatConfigOverride['php'], 2, 2)) as $line) { + foreach (explode(PHP_EOL, $yamlString) as $line) { $overrideOutput[] = str_repeat(' ', 4) . $line; } - $tugboatConfig['overrides']['php'] = rtrim(implode("\n", + + // Assign the formatted YAML string back to the configuration. + $tugboatConfig['overrides']['php'] = rtrim(implode("\n", $overrideOutput)); }