From b88d3a91b39a58cd9704b75f3fc11fb12f29e9ac Mon Sep 17 00:00:00 2001 From: Nicky De Maeyer Date: Tue, 15 Dec 2020 12:08:49 +0100 Subject: [PATCH] when tests and suite paths are "." we can safely set the suite --- src/Codeception/Command/Run.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Codeception/Command/Run.php b/src/Codeception/Command/Run.php index bcdcf0564e..4f154e56ca 100644 --- a/src/Codeception/Command/Run.php +++ b/src/Codeception/Command/Run.php @@ -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) { @@ -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)) { @@ -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,