mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
Get all VFS tests passing
on my machine, at least...
This commit is contained in:
parent
3027123fbd
commit
fb2abd8915
@ -43,7 +43,7 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase
|
||||
public function testSimpleReadWrite(): string
|
||||
{
|
||||
$info_id = $this->make_infolog();
|
||||
$this->files[] = $this->test_file = $this->getFilename(null, $info_id);
|
||||
$this->files[] = $this->test_file = $this->getInfologFilename(null, $info_id);
|
||||
|
||||
return parent::testSimpleReadWrite();
|
||||
}
|
||||
@ -51,7 +51,7 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase
|
||||
public function testNoReadAccess(): void
|
||||
{
|
||||
$info_id = $this->make_infolog();
|
||||
$this->files[] = $this->test_file = $this->getFilename(null, $info_id);
|
||||
$this->files[] = $this->test_file = $this->getInfologFilename(null, $info_id);
|
||||
|
||||
parent::testNoReadAccess();
|
||||
}
|
||||
@ -59,7 +59,7 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase
|
||||
public function testWithAccess(): void
|
||||
{
|
||||
$info_id = $this->make_infolog();
|
||||
$this->files[] = $this->test_file = $this->getFilename(null, $info_id);
|
||||
$this->files[] = $this->test_file = $this->getInfologFilename(null, $info_id);
|
||||
|
||||
parent::testWithAccess();
|
||||
}
|
||||
@ -101,12 +101,11 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase
|
||||
|
||||
/**
|
||||
* Make a filename that reflects the current test
|
||||
* @param $path
|
||||
* @param $info_id
|
||||
* @return string
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
protected function getFilename($path, $info_id)
|
||||
protected function getInfologFilename($path, $info_id)
|
||||
{
|
||||
if(is_null($path)) $path = '/apps/infolog/';
|
||||
if(substr($path,-1,1) !== '/') $path = $path . '/';
|
||||
|
@ -65,7 +65,9 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase
|
||||
|
||||
public function mount() : void
|
||||
{
|
||||
$this->files[] = Vfs::get_home_dir() . '/'. static::$test_dir;
|
||||
Api\Vfs\Sharing::setup_share(true,$this->share);
|
||||
Vfs::clearstatcache();
|
||||
}
|
||||
|
||||
public function createShare(&$dir='', $extra = array(), $create = 'createShare')
|
||||
|
@ -230,7 +230,7 @@ class SharingBackendTest extends SharingBase
|
||||
// Make symlink
|
||||
$this->files[] = $symlink = $target.'/symlink.txt';
|
||||
$file = $target.'/test_file.txt';
|
||||
if(Vfs::file_exists($symlink)) Vfs::remove($symlink);
|
||||
if(Vfs::is_link($symlink)) Vfs::unlink($symlink);
|
||||
$this->assertTrue(
|
||||
Vfs::symlink($file, $symlink),
|
||||
"Unable to create symlink $symlink => $file"
|
||||
@ -256,7 +256,7 @@ class SharingBackendTest extends SharingBase
|
||||
// Make symlink
|
||||
$this->files[] = $symlink = $target.'/symlinked_dir';
|
||||
$file = $target.'/sub_dir';
|
||||
if(Vfs::file_exists($symlink)) Vfs::remove($symlink);
|
||||
if(Vfs::is_link($symlink)) Vfs::unlink($symlink);
|
||||
$this->assertTrue(
|
||||
Vfs::symlink($file, $symlink),
|
||||
"Unable to create symlink $symlink => $file"
|
||||
@ -278,7 +278,7 @@ class SharingBackendTest extends SharingBase
|
||||
// Make symlink
|
||||
$this->files[] = $symlink = $target.'/symlinked_dir/';
|
||||
$file = $symlink.'subdir_test_file.txt';
|
||||
if(Vfs::file_exists($symlink)) Vfs::remove($symlink);
|
||||
if(Vfs::is_link($symlink)) Vfs::unlink($symlink);
|
||||
$this->assertTrue(
|
||||
Vfs::symlink($target.'/sub_dir/', $symlink),
|
||||
"Unable to create symlink $symlink => $target/sub_dir/"
|
||||
|
@ -108,6 +108,10 @@ class SharingBase extends LoggedInTest
|
||||
{
|
||||
$this->fail('Tried to remove root');
|
||||
}
|
||||
foreach($this->files as $file)
|
||||
{
|
||||
Vfs::unlink($file);
|
||||
}
|
||||
Vfs::remove($this->files);
|
||||
|
||||
// Remove any mounts
|
||||
|
@ -110,7 +110,9 @@ abstract class StreamWrapperBase extends LoggedInTest
|
||||
// Remove our other test user
|
||||
if($this->account_id)
|
||||
{
|
||||
$GLOBALS['egw']->accounts->delete($this->account_id);
|
||||
$command = new \admin_cmd_delete_account( $this->account_id, null, true);
|
||||
$command->comment = 'Removing in tearDown for unit test ' . $this->getName();
|
||||
$command->run();
|
||||
}
|
||||
|
||||
// Remove any added files (as root to limit versioning issues)
|
||||
@ -126,6 +128,9 @@ abstract class StreamWrapperBase extends LoggedInTest
|
||||
// Remove any mounts
|
||||
foreach($this->mounts as $mount)
|
||||
{
|
||||
// Do not remove /apps
|
||||
if($mount == '/apps') continue;
|
||||
|
||||
Vfs::umount($mount);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user