mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 00:58:55 +01:00
Add readable & writable share tests for entry filesystem (/apps/infolog/#)
This commit is contained in:
parent
33396193ce
commit
ff720b097a
@ -48,6 +48,11 @@ class SharingTest extends LoggedInTest
|
|||||||
*/
|
*/
|
||||||
protected $mounts = Array();
|
protected $mounts = Array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entries that have to be deleted after
|
||||||
|
*/
|
||||||
|
protected $entries = Array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options for searching the Vfs (Vfs::find())
|
* Options for searching the Vfs (Vfs::find())
|
||||||
*/
|
*/
|
||||||
@ -92,6 +97,13 @@ class SharingTest extends LoggedInTest
|
|||||||
Sharing::delete($share);
|
Sharing::delete($share);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach($this->entries as $entry)
|
||||||
|
{
|
||||||
|
list($callback, $params) = $entry;
|
||||||
|
call_user_func_array($callback, $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Vfs::$is_root = $backup;
|
Vfs::$is_root = $backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +112,7 @@ class SharingTest extends LoggedInTest
|
|||||||
* Test to make sure a readonly link to home gives just readonly access,
|
* Test to make sure a readonly link to home gives just readonly access,
|
||||||
* and just to user's home
|
* and just to user's home
|
||||||
*/
|
*/
|
||||||
public function testHomeReadonly()
|
public function _testHomeReadonly()
|
||||||
{
|
{
|
||||||
$dir = Vfs::get_home_dir().'/';
|
$dir = Vfs::get_home_dir().'/';
|
||||||
|
|
||||||
@ -111,7 +123,7 @@ class SharingTest extends LoggedInTest
|
|||||||
* Test to make sure a writable link to home gives write access, but just
|
* Test to make sure a writable link to home gives write access, but just
|
||||||
* to user's home
|
* to user's home
|
||||||
*/
|
*/
|
||||||
public function testHomeWritable()
|
public function _testHomeWritable()
|
||||||
{
|
{
|
||||||
$dir = Vfs::get_home_dir().'/';
|
$dir = Vfs::get_home_dir().'/';
|
||||||
|
|
||||||
@ -121,7 +133,7 @@ class SharingTest extends LoggedInTest
|
|||||||
/**
|
/**
|
||||||
* Test for a readonly share of a path with versioning turned on
|
* Test for a readonly share of a path with versioning turned on
|
||||||
*/
|
*/
|
||||||
public function testVersioningReadonly()
|
public function _testVersioningReadonly()
|
||||||
{
|
{
|
||||||
$this->files[] = $dir = Vfs::get_home_dir().'/versioned/';
|
$this->files[] = $dir = Vfs::get_home_dir().'/versioned/';
|
||||||
|
|
||||||
@ -137,7 +149,7 @@ class SharingTest extends LoggedInTest
|
|||||||
/**
|
/**
|
||||||
* Test for a writable share of a path with versioning turned on
|
* Test for a writable share of a path with versioning turned on
|
||||||
*/
|
*/
|
||||||
public function testVersioningWritable()
|
public function _testVersioningWritable()
|
||||||
{
|
{
|
||||||
$this->files[] = $dir = Vfs::get_home_dir().'/versioned/';
|
$this->files[] = $dir = Vfs::get_home_dir().'/versioned/';
|
||||||
|
|
||||||
@ -153,7 +165,7 @@ class SharingTest extends LoggedInTest
|
|||||||
/**
|
/**
|
||||||
* Test for a readonly share of a path from the filesystem
|
* Test for a readonly share of a path from the filesystem
|
||||||
*/
|
*/
|
||||||
public function testFilesystemReadonly()
|
public function _testFilesystemReadonly()
|
||||||
{
|
{
|
||||||
// Don't add to files list or it deletes the folder from filesystem
|
// Don't add to files list or it deletes the folder from filesystem
|
||||||
$dir = '/filesystem/';
|
$dir = '/filesystem/';
|
||||||
@ -173,7 +185,7 @@ class SharingTest extends LoggedInTest
|
|||||||
/**
|
/**
|
||||||
* Test for a readonly share of a path from the filesystem
|
* Test for a readonly share of a path from the filesystem
|
||||||
*/
|
*/
|
||||||
public function testFilesystemWritable()
|
public function _testFilesystemWritable()
|
||||||
{
|
{
|
||||||
// Don't add to files list or it deletes the folder from filesystem
|
// Don't add to files list or it deletes the folder from filesystem
|
||||||
$dir = '/filesystem/';
|
$dir = '/filesystem/';
|
||||||
@ -190,6 +202,42 @@ class SharingTest extends LoggedInTest
|
|||||||
$this->checkOneFile('/filesystem_test.txt', Sharing::WRITABLE);
|
$this->checkOneFile('/filesystem_test.txt', Sharing::WRITABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for a readonly share of an application entry's filesystem (/apps)
|
||||||
|
*/
|
||||||
|
public function testLinksReadonly()
|
||||||
|
{
|
||||||
|
// Create an infolog entry for testing purposes
|
||||||
|
$info_id = $this->make_infolog();
|
||||||
|
$bo = new \infolog_bo();
|
||||||
|
$dir = "/apps/infolog/$info_id/";
|
||||||
|
|
||||||
|
$this->assertTrue(Vfs::is_writable($dir), "Unable to write to '$dir' as expected");
|
||||||
|
|
||||||
|
$this->checkDirectory($dir, Sharing::READONLY);
|
||||||
|
|
||||||
|
// Can't delete it here, we're still the anonymous user until after
|
||||||
|
$this->entries[] = Array(Array($bo, 'delete'), Array($info_id, false, false, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for a writable share of an application entry's filesystem (/apps)
|
||||||
|
*/
|
||||||
|
public function testLinksWritable()
|
||||||
|
{
|
||||||
|
// Create an infolog entry for testing purposes
|
||||||
|
$bo = new \infolog_bo();
|
||||||
|
$info_id = $this->make_infolog();
|
||||||
|
$dir = "/apps/infolog/$info_id/";
|
||||||
|
|
||||||
|
$this->assertTrue(Vfs::is_writable($dir), "Unable to write to '$dir' as expected");
|
||||||
|
|
||||||
|
$this->checkDirectory($dir, Sharing::WRITABLE);
|
||||||
|
|
||||||
|
// Can't delete it here, we're still the anonymous user until after
|
||||||
|
$this->entries[] = Array(Array($bo, 'delete'), Array($info_id, false, false, true));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check a given directory to see that a link to it works.
|
* Check a given directory to see that a link to it works.
|
||||||
*
|
*
|
||||||
@ -407,6 +455,22 @@ class SharingTest extends LoggedInTest
|
|||||||
return $share;
|
return $share;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make an infolog entry
|
||||||
|
*/
|
||||||
|
protected function make_infolog()
|
||||||
|
{
|
||||||
|
$bo = new \infolog_bo();
|
||||||
|
$element = array(
|
||||||
|
'info_subject' => "Test infolog for #{$this->getName()}",
|
||||||
|
'info_des' => 'Test element for ' . $this->getName() ."\n". Api\DateTime::to(),
|
||||||
|
'info_status' => 'open'
|
||||||
|
);
|
||||||
|
|
||||||
|
$element_id = $bo->write($element, true, true, true, true);
|
||||||
|
return $element_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that a share link can be made, and that only that path is available
|
* Test that a share link can be made, and that only that path is available
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user