Skip to content

Commit

Permalink
when tests and suite paths are "." we can safely set the suite
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrl-f5 committed Dec 15, 2020
1 parent 81e0c80 commit b88d3a9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Codeception/Command/Run.php
Expand Up @@ -428,6 +428,8 @@ public function execute(InputInterface $input, OutputInterface $output)

protected function matchSingleTest($suite, $config)
{
list($file) = explode(':', $suite, -1);

// running a single test when suite has a configured path
if (isset($config['suites'])) {
foreach ($config['suites'] as $s => $suiteConfig) {
Expand All @@ -436,6 +438,9 @@ protected function matchSingleTest($suite, $config)
}
$testsPath = $config['paths']['tests'] . DIRECTORY_SEPARATOR . $suiteConfig['path'];
if ($suiteConfig['path'] === '.') {
if ($config['paths']['tests'] === '.') {
return ['', $s, $suite];
}
$testsPath = $config['paths']['tests'];
}
if (preg_match("~^$testsPath/(.*?)$~", $suite, $matches)) {
Expand All @@ -456,8 +461,7 @@ protected function matchSingleTest($suite, $config)
$realTestDir = realpath(Configuration::testsDir());
$cwd = getcwd();
if (strpos($realTestDir, $cwd) === 0) {
list($path) = explode(':', $suite);
$realPath = $cwd . DIRECTORY_SEPARATOR . $path;
$realPath = $cwd . DIRECTORY_SEPARATOR . $file;
if (file_exists($realPath) || is_dir($realPath)) {
return $this->matchTestFromFilename(
$cwd . DIRECTORY_SEPARATOR . $suite,
Expand Down

0 comments on commit b88d3a9

Please sign in to comment.