diff --git a/api/tests/Vfs/Links/StreamWrapperTest.php b/api/tests/Vfs/Links/StreamWrapperTest.php index d0ded387d9..89d074a9c0 100644 --- a/api/tests/Vfs/Links/StreamWrapperTest.php +++ b/api/tests/Vfs/Links/StreamWrapperTest.php @@ -43,7 +43,7 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase public function testSimpleReadWrite(): string { $info_id = $this->make_infolog(); - $this->files[] = $this->test_file = $this->getFilename(null, $info_id); + $this->files[] = $this->test_file = $this->getInfologFilename(null, $info_id); return parent::testSimpleReadWrite(); } @@ -51,7 +51,7 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase public function testNoReadAccess(): void { $info_id = $this->make_infolog(); - $this->files[] = $this->test_file = $this->getFilename(null, $info_id); + $this->files[] = $this->test_file = $this->getInfologFilename(null, $info_id); parent::testNoReadAccess(); } @@ -59,7 +59,7 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase public function testWithAccess(): void { $info_id = $this->make_infolog(); - $this->files[] = $this->test_file = $this->getFilename(null, $info_id); + $this->files[] = $this->test_file = $this->getInfologFilename(null, $info_id); parent::testWithAccess(); } @@ -101,12 +101,11 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase /** * Make a filename that reflects the current test - * @param $path * @param $info_id * @return string * @throws \ReflectionException */ - protected function getFilename($path, $info_id) + protected function getInfologFilename($path, $info_id) { if(is_null($path)) $path = '/apps/infolog/'; if(substr($path,-1,1) !== '/') $path = $path . '/'; diff --git a/api/tests/Vfs/Sharing/StreamWrapperTest.php b/api/tests/Vfs/Sharing/StreamWrapperTest.php index d15388837e..f278a31ca0 100644 --- a/api/tests/Vfs/Sharing/StreamWrapperTest.php +++ b/api/tests/Vfs/Sharing/StreamWrapperTest.php @@ -65,7 +65,9 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase public function mount() : void { + $this->files[] = Vfs::get_home_dir() . '/'. static::$test_dir; Api\Vfs\Sharing::setup_share(true,$this->share); + Vfs::clearstatcache(); } public function createShare(&$dir='', $extra = array(), $create = 'createShare') diff --git a/api/tests/Vfs/SharingBackendTest.php b/api/tests/Vfs/SharingBackendTest.php index 5da33932a8..aa4797875f 100644 --- a/api/tests/Vfs/SharingBackendTest.php +++ b/api/tests/Vfs/SharingBackendTest.php @@ -230,7 +230,7 @@ class SharingBackendTest extends SharingBase // Make symlink $this->files[] = $symlink = $target.'/symlink.txt'; $file = $target.'/test_file.txt'; - if(Vfs::file_exists($symlink)) Vfs::remove($symlink); + if(Vfs::is_link($symlink)) Vfs::unlink($symlink); $this->assertTrue( Vfs::symlink($file, $symlink), "Unable to create symlink $symlink => $file" @@ -256,7 +256,7 @@ class SharingBackendTest extends SharingBase // Make symlink $this->files[] = $symlink = $target.'/symlinked_dir'; $file = $target.'/sub_dir'; - if(Vfs::file_exists($symlink)) Vfs::remove($symlink); + if(Vfs::is_link($symlink)) Vfs::unlink($symlink); $this->assertTrue( Vfs::symlink($file, $symlink), "Unable to create symlink $symlink => $file" @@ -278,7 +278,7 @@ class SharingBackendTest extends SharingBase // Make symlink $this->files[] = $symlink = $target.'/symlinked_dir/'; $file = $symlink.'subdir_test_file.txt'; - if(Vfs::file_exists($symlink)) Vfs::remove($symlink); + if(Vfs::is_link($symlink)) Vfs::unlink($symlink); $this->assertTrue( Vfs::symlink($target.'/sub_dir/', $symlink), "Unable to create symlink $symlink => $target/sub_dir/" diff --git a/api/tests/Vfs/SharingBase.php b/api/tests/Vfs/SharingBase.php index ee63c729ff..99803ed946 100644 --- a/api/tests/Vfs/SharingBase.php +++ b/api/tests/Vfs/SharingBase.php @@ -108,6 +108,10 @@ class SharingBase extends LoggedInTest { $this->fail('Tried to remove root'); } + foreach($this->files as $file) + { + Vfs::unlink($file); + } Vfs::remove($this->files); // Remove any mounts diff --git a/api/tests/Vfs/StreamWrapperBase.php b/api/tests/Vfs/StreamWrapperBase.php index b3f482cd22..eccc02d50c 100644 --- a/api/tests/Vfs/StreamWrapperBase.php +++ b/api/tests/Vfs/StreamWrapperBase.php @@ -110,7 +110,9 @@ abstract class StreamWrapperBase extends LoggedInTest // Remove our other test user if($this->account_id) { - $GLOBALS['egw']->accounts->delete($this->account_id); + $command = new \admin_cmd_delete_account( $this->account_id, null, true); + $command->comment = 'Removing in tearDown for unit test ' . $this->getName(); + $command->run(); } // Remove any added files (as root to limit versioning issues) @@ -126,6 +128,9 @@ abstract class StreamWrapperBase extends LoggedInTest // Remove any mounts foreach($this->mounts as $mount) { + // Do not remove /apps + if($mount == '/apps') continue; + Vfs::umount($mount); }