From 532cbb7019e97b8e712f0980fe9307a0621d4d00 Mon Sep 17 00:00:00 2001 From: Roland Kalocsaven Date: Sat, 20 Feb 2021 10:47:03 +0000 Subject: [PATCH] Fix cleanup of included test directories. * Fix the loading of project configuration before cleanup * Add test to run clean command with include functionality * Fix directory separator in clean command test Co-authored-by: Roland Kalocsaven --- src/Codeception/Command/Clean.php | 3 ++- tests/cli/IncludedCest.php | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Codeception/Command/Clean.php b/src/Codeception/Command/Clean.php index cfe8f7a800..6adb10a9c2 100644 --- a/src/Codeception/Command/Clean.php +++ b/src/Codeception/Command/Clean.php @@ -32,11 +32,12 @@ protected function execute(InputInterface $input, OutputInterface $output) private function cleanProjectsRecursively(OutputInterface $output, $projectDir) { + $config = Configuration::config($projectDir); + $logDir = Configuration::logDir(); $output->writeln("Cleaning up output " . $logDir . "..."); FileSystem::doEmptyDir($logDir); - $config = Configuration::config($projectDir); $subProjects = $config['include']; foreach ($subProjects as $subProject) { $subProjectDir = $projectDir . $subProject; diff --git a/tests/cli/IncludedCest.php b/tests/cli/IncludedCest.php index 0f9fe51b08..2e790d0311 100644 --- a/tests/cli/IncludedCest.php +++ b/tests/cli/IncludedCest.php @@ -166,4 +166,21 @@ public function buildIncluded(\CliGuy $I) $I->seeInShellOutput('Jazz\\Pianist\\TestGuy'); $I->seeInShellOutput('Shire\\TestGuy'); } + + /** + * @before moveToIncluded + * @param CliGuy $I + */ + public function cleanIncluded(\CliGuy $I) + { + $ds = DIRECTORY_SEPARATOR; + + $I->executeCommand('clean'); + $I->seeInShellOutput("included{$ds}_log"); + $I->seeInShellOutput("included{$ds}jazz{$ds}tests/_log"); + $I->seeInShellOutput("included{$ds}jazz{$ds}pianist{$ds}tests/_log"); + $I->seeInShellOutput("included{$ds}shire{$ds}tests/_log"); + $I->seeInShellOutput('Done'); + } + }