From 38add67ea927504ffffb4cf17465aa1fb7ee4927 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 7 Jul 2021 13:11:44 -0600 Subject: [PATCH] Better VFS test cleanup --- api/tests/Vfs/Sharing/StreamWrapperTest.php | 1 + api/tests/Vfs/SharingBase.php | 10 +++++++++- api/tests/Vfs/StreamWrapperBase.php | 9 ++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/api/tests/Vfs/Sharing/StreamWrapperTest.php b/api/tests/Vfs/Sharing/StreamWrapperTest.php index f278a31ca0..f3883abec4 100644 --- a/api/tests/Vfs/Sharing/StreamWrapperTest.php +++ b/api/tests/Vfs/Sharing/StreamWrapperTest.php @@ -26,6 +26,7 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase protected function setUp() : void { + $this->files[] = $this->getFilename('',false); $this->createShare(); parent::setUp(); } diff --git a/api/tests/Vfs/SharingBase.php b/api/tests/Vfs/SharingBase.php index 99803ed946..58f0b44432 100644 --- a/api/tests/Vfs/SharingBase.php +++ b/api/tests/Vfs/SharingBase.php @@ -110,7 +110,14 @@ class SharingBase extends LoggedInTest } foreach($this->files as $file) { - Vfs::unlink($file); + if(Vfs::is_dir($file) && !Vfs::is_link(($file))) + { + Vfs::rmdir($file); + } + else + { + Vfs::unlink($file); + } } Vfs::remove($this->files); @@ -164,6 +171,7 @@ class SharingBase extends LoggedInTest if(!Vfs::is_readable($dir)) { Vfs::mkdir($dir); + $this->files[] = $dir; } $this->files += $this->addFiles($dir); diff --git a/api/tests/Vfs/StreamWrapperBase.php b/api/tests/Vfs/StreamWrapperBase.php index eccc02d50c..cfae4a5c0e 100644 --- a/api/tests/Vfs/StreamWrapperBase.php +++ b/api/tests/Vfs/StreamWrapperBase.php @@ -122,7 +122,14 @@ abstract class StreamWrapperBase extends LoggedInTest } foreach($this->files as $file) { - Vfs::unlink($file); + if(Vfs::is_dir($file) && !Vfs::is_link(($file))) + { + Vfs::rmdir($file); + } + else + { + Vfs::unlink($file); + } } // Remove any mounts