Skip to content

Commit

Permalink
Fix cleanup of included test directories.
Browse files Browse the repository at this point in the history
* 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 <roland.kalocsaven@itech.media>
  • Loading branch information
rolandsaven and rolandlgnd committed Feb 20, 2021
1 parent 516d1d4 commit 532cbb7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Codeception/Command/Clean.php
Expand Up @@ -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("<info>Cleaning up output " . $logDir . "...</info>");
FileSystem::doEmptyDir($logDir);

$config = Configuration::config($projectDir);
$subProjects = $config['include'];
foreach ($subProjects as $subProject) {
$subProjectDir = $projectDir . $subProject;
Expand Down
17 changes: 17 additions & 0 deletions tests/cli/IncludedCest.php
Expand Up @@ -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');
}

}

0 comments on commit 532cbb7

Please sign in to comment.