diff --git a/src/Codeception/Util/FileSystem.php b/src/Codeception/Util/FileSystem.php index f896defc9c..ce79aea77f 100644 --- a/src/Codeception/Util/FileSystem.php +++ b/src/Codeception/Util/FileSystem.php @@ -20,7 +20,7 @@ public static function doEmptyDir($path) foreach ($iterator as $path) { $basename = basename((string)$path); - if ($basename === '.' || $basename === '..' || $basename === '.gitignore') { + if ($basename === '.' || $basename === '..' || $basename === '.gitignore' || $basename === '.gitkeep') { continue; } diff --git a/tests/cli/CleanCest.php b/tests/cli/CleanCest.php new file mode 100644 index 0000000000..6e9609c63c --- /dev/null +++ b/tests/cli/CleanCest.php @@ -0,0 +1,21 @@ +amInPath('tests/data/included'); + $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'); + $I->seeFileFound("_log/.gitkeep"); + $I->seeFileFound("jazz{$ds}tests/_log/.gitkeep"); + $I->seeFileFound("jazz{$ds}pianist{$ds}tests/_log/.gitkeep"); + $I->seeFileFound("shire{$ds}tests/_log/.gitkeep"); + } +} diff --git a/tests/cli/IncludedCest.php b/tests/cli/IncludedCest.php index 2e790d0311..d1e4c2d8e2 100644 --- a/tests/cli/IncludedCest.php +++ b/tests/cli/IncludedCest.php @@ -6,7 +6,6 @@ public function _before() { $logDir = codecept_root_dir('tests/data/included/_log'); \Codeception\Util\FileSystem::doEmptyDir($logDir); - file_put_contents($logDir . '/.gitkeep', ''); } /**