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

Fix issue when using includes in combination with override config #5978

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/Codeception/Command/Run.php
Expand Up @@ -337,19 +337,22 @@ public function execute(InputInterface $input, OutputInterface $output)
// Find if the suite begins with an include path
if (strpos($suite, $include) === 0) {
// Use include config
$config = Configuration::config($projectDir.$include);
$includeConfig = Configuration::config($projectDir.$include);

if (!isset($config['paths']['tests'])) {
if (!isset($includeConfig['paths']['tests'])) {
throw new \RuntimeException(
sprintf("Included '%s' has no tests path configured", $include)
);
}

$testsPath = $include . DIRECTORY_SEPARATOR. $config['paths']['tests'];
$testsPath = $include . DIRECTORY_SEPARATOR. $includeConfig['paths']['tests'];

try {
list(, $suite, $test) = $this->matchTestFromFilename($suite, $testsPath);
$isIncludeTest = true;
$config = $includeConfig;
if (count($this->options['override'])) {
$config = $this->overrideConfig($this->options['override']);
}
} catch (\InvalidArgumentException $e) {
// Incorrect include match, continue trying to find one
continue;
Expand All @@ -361,11 +364,6 @@ public function execute(InputInterface $input, OutputInterface $output)
}
}
}

// Restore main config
if (!$isIncludeTest) {
$config = Configuration::config($projectDir);
}
} elseif (!empty($suite)) {
$result = $this->matchSingleTest($suite, $config);
if ($result) {
Expand Down