Correctly remove temp test directory tree

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2017-12-28 13:41:38 +01:00
parent 87b1839cd1
commit 9fa49c7f24
No known key found for this signature in database
GPG Key ID: FB5ACEED51955BF8
1 changed files with 13 additions and 1 deletions

View File

@ -399,6 +399,18 @@ class SCSSCacherTest extends \Test\TestCase {
return sha1(uniqid(mt_rand(), true));
}
private function rrmdir($directory) {
$files = array_diff(scandir($directory), array('.','..'));
foreach ($files as $file) {
if (is_dir($directory . '/' . $file)) {
$this->rrmdir($directory . '/' . $file);
} else {
unlink($directory . '/' . $file);
}
}
return rmdir($directory);
}
/**
* @param $path
* @param $appName
@ -418,7 +430,7 @@ class SCSSCacherTest extends \Test\TestCase {
$actual = self::invokePrivate($this->scssCacher, 'getWebDir', [$tmpDir.$path, $appName, $tmpDir.$serverRoot, $webRoot]);
$this->assertEquals($correctWebDir, $actual);
array_pop(\OC::$APPSROOTS);
rmdir($tmpDir.$path);
$this->rrmdir($tmpDir.$path);
}
}