mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
Refactor sharing tests to use a base class so Collabora tests can exend it
This commit is contained in:
parent
97134373dc
commit
2de26a0f2b
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user