Better VFS test cleanup

This commit is contained in:
nathan 2021-07-07 13:11:44 -06:00
parent a8ae92e1cc
commit 157926ab00
3 changed files with 18 additions and 2 deletions

View File

@ -26,6 +26,7 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase
protected function setUp() : void protected function setUp() : void
{ {
$this->files[] = $this->getFilename('',false);
$this->createShare(); $this->createShare();
parent::setUp(); parent::setUp();
} }

View File

@ -109,9 +109,16 @@ class SharingBase extends LoggedInTest
$this->fail('Tried to remove root'); $this->fail('Tried to remove root');
} }
foreach($this->files as $file) foreach($this->files as $file)
{
if(Vfs::is_dir($file) && !Vfs::is_link(($file)))
{
Vfs::rmdir($file);
}
else
{ {
Vfs::unlink($file); Vfs::unlink($file);
} }
}
Vfs::remove($this->files); Vfs::remove($this->files);
// Remove any mounts // Remove any mounts
@ -164,6 +171,7 @@ class SharingBase extends LoggedInTest
if(!Vfs::is_readable($dir)) if(!Vfs::is_readable($dir))
{ {
Vfs::mkdir($dir); Vfs::mkdir($dir);
$this->files[] = $dir;
} }
$this->files += $this->addFiles($dir); $this->files += $this->addFiles($dir);

View File

@ -121,9 +121,16 @@ abstract class StreamWrapperBase extends LoggedInTest
$this->fail('Tried to remove root'); $this->fail('Tried to remove root');
} }
foreach($this->files as $file) foreach($this->files as $file)
{
if(Vfs::is_dir($file) && !Vfs::is_link(($file)))
{
Vfs::rmdir($file);
}
else
{ {
Vfs::unlink($file); Vfs::unlink($file);
} }
}
// Remove any mounts // Remove any mounts
foreach($this->mounts as $mount) foreach($this->mounts as $mount)