Skip to content

Commit c59a37f

Browse files
committed
Use Folder::unlink() instead of handcrafted workaround
See xp-framework/core#335
1 parent aad6b5a commit c59a37f

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/test/php/com/amazon/aws/lambda/unittest/PackagingTest.class.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,6 @@ private function tempDir(): Folder {
1919
return $f;
2020
}
2121

22-
/** @return void */
23-
private function removeDir(Folder $folder) {
24-
foreach ($folder->entries() as $entry) {
25-
switch ($m= lstat($entry)['mode'] & 0170000) {
26-
case Sources::IS_LINK: unlink($entry); break;
27-
case Sources::IS_FILE: $entry->asFile()->unlink(); break;
28-
case Sources::IS_FOLDER: $this->removeDir($entry->asFolder()); break;
29-
}
30-
}
31-
}
32-
3322
/** Creates files and directory from given definitions */
3423
private function create(array $definitions, Folder $folder= null): Path {
3524
$folder ?? $folder= $this->tempDir();
@@ -75,7 +64,7 @@ private function package(Sources $sources): ZipIterator {
7564
#[After]
7665
private function cleanup() {
7766
foreach ($this->cleanup as $folder) {
78-
$this->removeDir($folder);
67+
$folder->unlink();
7968
}
8069
}
8170

0 commit comments

Comments
 (0)