From 2de26a0f2b79a3169180f5390abb3ee5202934d8 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 4 Apr 2018 15:00:47 -0600 Subject: [PATCH] Refactor sharing tests to use a base class so Collabora tests can exend it --- api/tests/Vfs/SharingBase.php | 10 ++++++- api/tests/Vfs/SharingTest.php | 52 ++--------------------------------- 2 files changed, 11 insertions(+), 51 deletions(-) diff --git a/api/tests/Vfs/SharingBase.php b/api/tests/Vfs/SharingBase.php index 98c6c622a2..1e698164f2 100644 --- a/api/tests/Vfs/SharingBase.php +++ b/api/tests/Vfs/SharingBase.php @@ -267,9 +267,16 @@ class SharingBase extends LoggedInTest // Vfs breaks if path has trailing / if(substr($path, -1) == '/') $path = substr($path, 0, -1); + $backup = Vfs::$is_root; Vfs::$is_root = true; - $url = \EGroupware\Stylite\Vfs\Merge\StreamWrapper::SCHEME.'://default'.$path.'?merge=api/tests/fixtures/Vfs/filesystem_mount'; + + // I guess merge needs the dir in SQLFS first + Vfs::mkdir($path); + Vfs::chmod($path, 0750); + Vfs::chown($path, $GLOBALS['egw_info']['user']['account_id']); + + $url = \EGroupware\Stylite\Vfs\Merge\StreamWrapper::SCHEME.'://default'.$path.'?merge=' . realpath(__DIR__ . '/../fixtures/Vfs/filesystem_mount'); $this->assertTrue(Vfs::mount($url,$path), "Unable to mount $url to $path"); Vfs::$is_root = $backup; @@ -316,6 +323,7 @@ class SharingBase extends LoggedInTest ); // Symlinked file + /* // Always says its empty $files[] = $symlink = $path.'symlink.txt'; if(Vfs::file_exists($symlink)) Vfs::remove($symlink); diff --git a/api/tests/Vfs/SharingTest.php b/api/tests/Vfs/SharingTest.php index 774c929ea8..4ddf0bcd6d 100644 --- a/api/tests/Vfs/SharingTest.php +++ b/api/tests/Vfs/SharingTest.php @@ -17,10 +17,10 @@ namespace EGroupware\Api\Vfs; -use EGroupware\Api; +require_once __DIR__ . '/SharingBase.php'; + use EGroupware\Api\Vfs; use EGroupware\Api\LoggedInTest as LoggedInTest; -use EGroupware\Stylite\Vfs\Versioning; class SharingTest extends SharingBase @@ -62,54 +62,6 @@ class SharingTest extends SharingBase 'maxdepth' => 5 ); - public function setUp() - { - - } - - public function tearDown() - { - LoggedInTest::tearDownAfterClass(); - LoggedInTest::setupBeforeClass(); - - // Re-init, since they look at user, fstab, etc. - // Also, further tests that access the filesystem fail if we don't - Vfs::clearstatcache(); - Vfs::init_static(); - Vfs\StreamWrapper::init_static(); - - // Need to ask about mounts, or other tests fail - Vfs::mount(); - - $backup = Vfs::$is_root; - Vfs::$is_root = true; - - // Remove any added files (as root to limit versioning issues) - Vfs::remove($this->files); - - // Remove any mounts - foreach($this->mounts as $mount) - { - Vfs::umount($mount); - } - - // Remove any added shares - foreach($this->shares as $share) - { - Sharing::delete($share); - } - - foreach($this->entries as $entry) - { - list($callback, $params) = $entry; - call_user_func_array($callback, $params); - } - - - Vfs::$is_root = $backup; - } - - /** * Test to make sure a readonly link to home gives just readonly access, * and just to user's home