Skip to content

Commit

Permalink
use overwriting config when running included apps
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinalkan committed May 6, 2022
1 parent eb9c76e commit 48308b2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Codeception/Command/Run.php
Expand Up @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions tests/cli/IncludedCest.php
Expand Up @@ -205,4 +205,19 @@ public function includedSuitesAreNotRunTwice (CliGuy $I) {
$I->seeInShellOutput('2 tests');
$I->dontSeeInShellOutput('4 tests');
}

/**
* @param CliGuy $I
* @before moveToIncluded
*/
public function overwrittenConfigurationIsAlsoAppliedWhenRunningAnIncludedAppFromTheRootApp(CliGuy $I)
{
if(PHP_VERSION_ID < 700100) {
$I->markTestSkipped('This test can only run on PHP >= 7.1 because of reporter type declarations.');
}
$I->executeCommand('run jazz/tests/functional --report -o "reporters: report: Jazz\CustomReporter1"');
$I->seeInShellOutput('CustomReporter1');
}


}
14 changes: 14 additions & 0 deletions tests/data/included/jazz/tests/_helpers/CustomReporter1.php
@@ -0,0 +1,14 @@
<?php

namespace Jazz;

use Codeception\PHPUnit\ResultPrinter\Report;

final class CustomReporter1 extends Report
{
public function endTest(\PHPUnit\Framework\Test $test, float $time) :void
{
$this->write('CustomReporter1');
}

}

0 comments on commit 48308b2

Please sign in to comment.