forked from extern/egroupware
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
|
public function testSimpleReadWrite(): string
|
||||||
{
|
{
|
||||||
$info_id = $this->make_infolog();
|
$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();
|
return parent::testSimpleReadWrite();
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase
|
|||||||
public function testNoReadAccess(): void
|
public function testNoReadAccess(): void
|
||||||
{
|
{
|
||||||
$info_id = $this->make_infolog();
|
$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();
|
parent::testNoReadAccess();
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase
|
|||||||
public function testWithAccess(): void
|
public function testWithAccess(): void
|
||||||
{
|
{
|
||||||
$info_id = $this->make_infolog();
|
$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();
|
parent::testWithAccess();
|
||||||
}
|
}
|
||||||
@ -101,12 +101,11 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a filename that reflects the current test
|
* Make a filename that reflects the current test
|
||||||
* @param $path
|
|
||||||
* @param $info_id
|
* @param $info_id
|
||||||
* @return string
|
* @return string
|
||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
protected function getFilename($path, $info_id)
|
protected function getInfologFilename($path, $info_id)
|
||||||
{
|
{
|
||||||
if(is_null($path)) $path = '/apps/infolog/';
|
if(is_null($path)) $path = '/apps/infolog/';
|
||||||
if(substr($path,-1,1) !== '/') $path = $path . '/';
|
if(substr($path,-1,1) !== '/') $path = $path . '/';
|
||||||
|
@ -65,7 +65,9 @@ class StreamWrapperTest extends Vfs\StreamWrapperBase
|
|||||||
|
|
||||||
public function mount() : void
|
public function mount() : void
|
||||||
{
|
{
|
||||||
|
$this->files[] = Vfs::get_home_dir() . '/'. static::$test_dir;
|
||||||
Api\Vfs\Sharing::setup_share(true,$this->share);
|
Api\Vfs\Sharing::setup_share(true,$this->share);
|
||||||
|
Vfs::clearstatcache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createShare(&$dir='', $extra = array(), $create = 'createShare')
|
public function createShare(&$dir='', $extra = array(), $create = 'createShare')
|
||||||
|
@ -230,7 +230,7 @@ class SharingBackendTest extends SharingBase
|
|||||||
// Make symlink
|
// Make symlink
|
||||||
$this->files[] = $symlink = $target.'/symlink.txt';
|
$this->files[] = $symlink = $target.'/symlink.txt';
|
||||||
$file = $target.'/test_file.txt';
|
$file = $target.'/test_file.txt';
|
||||||
if(Vfs::file_exists($symlink)) Vfs::remove($symlink);
|
if(Vfs::is_link($symlink)) Vfs::unlink($symlink);
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
Vfs::symlink($file, $symlink),
|
Vfs::symlink($file, $symlink),
|
||||||
"Unable to create symlink $symlink => $file"
|
"Unable to create symlink $symlink => $file"
|
||||||
@ -256,7 +256,7 @@ class SharingBackendTest extends SharingBase
|
|||||||
// Make symlink
|
// Make symlink
|
||||||
$this->files[] = $symlink = $target.'/symlinked_dir';
|
$this->files[] = $symlink = $target.'/symlinked_dir';
|
||||||
$file = $target.'/sub_dir';
|
$file = $target.'/sub_dir';
|
||||||
if(Vfs::file_exists($symlink)) Vfs::remove($symlink);
|
if(Vfs::is_link($symlink)) Vfs::unlink($symlink);
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
Vfs::symlink($file, $symlink),
|
Vfs::symlink($file, $symlink),
|
||||||
"Unable to create symlink $symlink => $file"
|
"Unable to create symlink $symlink => $file"
|
||||||
@ -278,7 +278,7 @@ class SharingBackendTest extends SharingBase
|
|||||||
// Make symlink
|
// Make symlink
|
||||||
$this->files[] = $symlink = $target.'/symlinked_dir/';
|
$this->files[] = $symlink = $target.'/symlinked_dir/';
|
||||||
$file = $symlink.'subdir_test_file.txt';
|
$file = $symlink.'subdir_test_file.txt';
|
||||||
if(Vfs::file_exists($symlink)) Vfs::remove($symlink);
|
if(Vfs::is_link($symlink)) Vfs::unlink($symlink);
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
Vfs::symlink($target.'/sub_dir/', $symlink),
|
Vfs::symlink($target.'/sub_dir/', $symlink),
|
||||||
"Unable to create symlink $symlink => $target/sub_dir/"
|
"Unable to create symlink $symlink => $target/sub_dir/"
|
||||||
|
@ -108,6 +108,10 @@ class SharingBase extends LoggedInTest
|
|||||||
{
|
{
|
||||||
$this->fail('Tried to remove root');
|
$this->fail('Tried to remove root');
|
||||||
}
|
}
|
||||||
|
foreach($this->files as $file)
|
||||||
|
{
|
||||||
|
Vfs::unlink($file);
|
||||||
|
}
|
||||||
Vfs::remove($this->files);
|
Vfs::remove($this->files);
|
||||||
|
|
||||||
// Remove any mounts
|
// Remove any mounts
|
||||||
|
@ -110,7 +110,9 @@ abstract class StreamWrapperBase extends LoggedInTest
|
|||||||
// Remove our other test user
|
// Remove our other test user
|
||||||
if($this->account_id)
|
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)
|
// Remove any added files (as root to limit versioning issues)
|
||||||
@ -126,6 +128,9 @@ abstract class StreamWrapperBase extends LoggedInTest
|
|||||||
// Remove any mounts
|
// Remove any mounts
|
||||||
foreach($this->mounts as $mount)
|
foreach($this->mounts as $mount)
|
||||||
{
|
{
|
||||||
|
// Do not remove /apps
|
||||||
|
if($mount == '/apps') continue;
|
||||||
|
|
||||||
Vfs::umount($mount);
|
Vfs::umount($mount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user