mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 17:18:54 +01:00
WIP on sharing test
try to fix it for Travis
This commit is contained in:
parent
17a759dbe1
commit
a4e80ea9a0
@ -24,6 +24,7 @@ class SharingTest extends LoggedInTest
|
|||||||
|
|
||||||
// Keep some server stuff to reset when done
|
// Keep some server stuff to reset when done
|
||||||
protected $original_server;
|
protected $original_server;
|
||||||
|
protected $original_user;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
@ -31,13 +32,20 @@ class SharingTest extends LoggedInTest
|
|||||||
'REQUEST_URI' => $_SERVER['REQUEST_URI'],
|
'REQUEST_URI' => $_SERVER['REQUEST_URI'],
|
||||||
'SCRIPT_NAME' => $_SERVER['SCRIPT_NAME']
|
'SCRIPT_NAME' => $_SERVER['SCRIPT_NAME']
|
||||||
);
|
);
|
||||||
|
$this->original_user = $GLOBALS['egw_info']['user'];
|
||||||
}
|
}
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
|
//echo "\n\nEnding " . $this->getName() . "\n";
|
||||||
$_SERVER += $this->original_server;
|
$_SERVER += $this->original_server;
|
||||||
|
$GLOBALS['egw_info']['user'] = $this->original_user;
|
||||||
|
|
||||||
$GLOBALS['egw']->session->destroy($GLOBALS['egw']->session->sessionid, $GLOBALS['egw']->session->kp3);
|
$GLOBALS['egw']->session->destroy($GLOBALS['egw']->session->sessionid, $GLOBALS['egw']->session->kp3);
|
||||||
|
|
||||||
|
// This resets the VFS, but logs in anonymous
|
||||||
LoggedInTest::setupBeforeClass();
|
LoggedInTest::setupBeforeClass();
|
||||||
|
$GLOBALS['egw_info']['user'] = $this->original_user;
|
||||||
|
Vfs::$user = $GLOBALS['egw_info']['user']['account_id'];
|
||||||
|
|
||||||
// Need to ask about mounts, or other tests fail
|
// Need to ask about mounts, or other tests fail
|
||||||
Vfs::mount();
|
Vfs::mount();
|
||||||
@ -55,8 +63,10 @@ class SharingTest extends LoggedInTest
|
|||||||
*/
|
*/
|
||||||
public function testHomeReadonly()
|
public function testHomeReadonly()
|
||||||
{
|
{
|
||||||
$dir = Vfs::get_home_dir();
|
$dir = Vfs::get_home_dir().'/test_subdir/';
|
||||||
|
Vfs::mkdir($dir);
|
||||||
|
|
||||||
|
//var_dump(Vfs::find('/',array('maxdepth' => 1)));
|
||||||
$logged_in_files = array_map(
|
$logged_in_files = array_map(
|
||||||
function($path) use ($dir) {return str_replace($dir, '/', $path);},
|
function($path) use ($dir) {return str_replace($dir, '/', $path);},
|
||||||
Vfs::find($dir)
|
Vfs::find($dir)
|
||||||
@ -65,6 +75,7 @@ class SharingTest extends LoggedInTest
|
|||||||
|
|
||||||
$files = Vfs::find(Vfs::get_home_dir());
|
$files = Vfs::find(Vfs::get_home_dir());
|
||||||
|
|
||||||
|
//var_dump(Vfs::find('/test_subdir',array('maxdepth' => 1)));
|
||||||
// Make sure files are the same
|
// Make sure files are the same
|
||||||
$this->assertEquals($logged_in_files, $files);
|
$this->assertEquals($logged_in_files, $files);
|
||||||
|
|
||||||
@ -85,16 +96,19 @@ class SharingTest extends LoggedInTest
|
|||||||
'This test has not been implemented yet.'
|
'This test has not been implemented yet.'
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// trearDown still not completely cleaning up, vfs fstab stays
|
// Still have problems finding the files
|
||||||
|
|
||||||
|
var_dump(Vfs::find('/',array('maxdepth' => 1)));
|
||||||
|
$dir = Vfs::get_home_dir().'/test_subdir/';
|
||||||
|
|
||||||
$dir = Vfs::get_home_dir();
|
|
||||||
var_dump(Vfs::mount());
|
|
||||||
$logged_in_files = array_map(
|
$logged_in_files = array_map(
|
||||||
function($path) use ($dir) {return str_replace($dir, '/', $path);},
|
function($path) use ($dir) {return str_replace($dir, '/', $path);},
|
||||||
Vfs::find($dir)
|
Vfs::find($dir)
|
||||||
);
|
);
|
||||||
|
var_dump($logged_in_files);
|
||||||
$this->shareLink($dir, Sharing::WRITABLE);
|
$this->shareLink($dir, Sharing::WRITABLE);
|
||||||
$files = Vfs::find(Vfs::get_home_dir());
|
var_dump(Vfs::find('/',array('maxdepth' => 1)));
|
||||||
|
$files = Vfs::find(Vfs::get_home_dir().'/test_subdir');
|
||||||
|
|
||||||
// Make sure files are the same
|
// Make sure files are the same
|
||||||
$this->assertEquals($logged_in_files, $files);
|
$this->assertEquals($logged_in_files, $files);
|
||||||
@ -102,6 +116,7 @@ var_dump(Vfs::mount());
|
|||||||
// Make sure all are writable
|
// Make sure all are writable
|
||||||
foreach($files as $file)
|
foreach($files as $file)
|
||||||
{
|
{
|
||||||
|
echo "\t".$file . "\n";
|
||||||
$this->assertTrue(Vfs::is_writable($file), $file . ' was not writable');
|
$this->assertTrue(Vfs::is_writable($file), $file . ' was not writable');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,6 +147,7 @@ var_dump(Vfs::mount());
|
|||||||
*/
|
*/
|
||||||
public function shareLink($path, $mode)
|
public function shareLink($path, $mode)
|
||||||
{
|
{
|
||||||
|
echo __METHOD__ . "('$path',$mode)\n";
|
||||||
// Setup - create path and share
|
// Setup - create path and share
|
||||||
$share = $this->createShare($path, $mode);
|
$share = $this->createShare($path, $mode);
|
||||||
$link = Vfs\Sharing::share2link($share);
|
$link = Vfs\Sharing::share2link($share);
|
||||||
@ -204,6 +220,8 @@ var_dump(Vfs::mount());
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
static::load_egw('anonymous','','',$GLOBALS['egw_info']);
|
static::load_egw('anonymous','','',$GLOBALS['egw_info']);
|
||||||
|
ob_end_clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user