From 74a4ed943c83363a7f02e94d0f97ffc2898efa58 Mon Sep 17 00:00:00 2001 From: Calvin Alkan Date: Fri, 6 May 2022 16:36:34 +0200 Subject: [PATCH] use overwriting config when running included apps See: #5978 --- src/Codeception/Command/Run.php | 6 +++++- tests/cli/IncludedCest.php | 12 ++++++++++++ .../jazz/tests/_helpers/CustomReporter1.php | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/data/included/jazz/tests/_helpers/CustomReporter1.php diff --git a/src/Codeception/Command/Run.php b/src/Codeception/Command/Run.php index 237af968d5..20db2b641e 100644 --- a/src/Codeception/Command/Run.php +++ b/src/Codeception/Command/Run.php @@ -350,7 +350,11 @@ public function execute(InputInterface $input, OutputInterface $output) if (strpos($suite, $include) === 0) { // Use include config $config = Configuration::config($projectDir.$include); - + + if(!empty($this->options['override'])) { + $config = $this->overrideConfig($this->options['override']); + } + if (!isset($config['paths']['tests'])) { throw new \RuntimeException( sprintf("Included '%s' has no tests path configured", $include) diff --git a/tests/cli/IncludedCest.php b/tests/cli/IncludedCest.php index e63371842e..023d7ae55e 100644 --- a/tests/cli/IncludedCest.php +++ b/tests/cli/IncludedCest.php @@ -205,4 +205,16 @@ public function includedSuitesAreNotRunTwice (CliGuy $I) { $I->seeInShellOutput('2 tests'); $I->dontSeeInShellOutput('4 tests'); } + + /** + * @param CliGuy $I + * @before moveToIncluded + */ + public function overwrittenConfigurationIsAlsoAppliedWhenRunningAnIncludedAppFromTheRootApp(CliGuy $I) + { + $I->executeCommand('run jazz/tests/functional --report -o "reporters: report: Jazz\CustomReporter1"'); + $I->seeInShellOutput('CustomReporter1'); + } + + } diff --git a/tests/data/included/jazz/tests/_helpers/CustomReporter1.php b/tests/data/included/jazz/tests/_helpers/CustomReporter1.php new file mode 100644 index 0000000000..fa98e848f2 --- /dev/null +++ b/tests/data/included/jazz/tests/_helpers/CustomReporter1.php @@ -0,0 +1,14 @@ +write('CustomReporter1'); + } + +} \ No newline at end of file