Refactor sharing tests to use a base class so Collabora tests can exend it

This commit is contained in:
nathangray 2018-04-04 15:00:47 -06:00
parent 97134373dc
commit 2de26a0f2b
2 changed files with 11 additions and 51 deletions

View File

@ -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);

View File

@ -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