9use Mockery\MockInterface;
 
   10use PHPUnit\Framework\TestCase;
 
   51    protected function setUp(): void
 
   56        $dataDir = 
'/dummy/var/www/ildata';
 
   61        define(
"CLIENT_DATA_DIR", $dataDir . 
'/' . 
$clientId);
 
   64        define(
"ILIAS_WEB_DIR", $webDir);
 
   65        define(
"CLIENT_ID", 
'default');
 
   71        $this->tempPath = sys_get_temp_dir();
 
   74        $this->filesystemsMock = \Mockery::mock(Filesystems::class);
 
   76        $containerMock = Mockery::mock(Container::class);
 
   77        $containerMock->shouldReceive(
'filesystem')
 
   80            ->andReturn($this->filesystemsMock);
 
   92        $target = $this->webPath . 
'/testtarget';
 
   94        $this->filesystemsMock
 
   95            ->shouldReceive(
'web')
 
   97            ->andReturn(Mockery::mock(Filesystem::class));
 
  100        $this->assertTrue($filesystem instanceof 
Filesystem, 
'Expecting filesystem instance.');
 
  110        $target = $this->storagePath . 
'/testtarget';
 
  112        $this->filesystemsMock
 
  113            ->shouldReceive(
'storage')
 
  115            ->andReturn(Mockery::mock(Filesystem::class));
 
  118        $this->assertTrue($filesystem instanceof 
Filesystem, 
'Expecting filesystem instance.');
 
  128        $target = 
'./libs/bower/bower_components/mediaelement/build';
 
  130        $this->filesystemsMock
 
  131            ->shouldReceive(
'libs')
 
  133            ->andReturn(Mockery::mock(Filesystem::class));
 
  136        $this->assertTrue($filesystem instanceof 
Filesystem, 
'Expecting filesystem instance.');
 
  145        $target = $this->libsPath . 
'libs/bower/bower_components/mediaelement/build';
 
  147        $this->filesystemsMock
 
  148            ->shouldReceive(
'libs')
 
  150            ->andReturn(Mockery::mock(Filesystem::class));
 
  153        $this->assertTrue($filesystem instanceof 
Filesystem, 
'Expecting filesystem instance.');
 
  163        $target = 
'/invalid/path/to/testtarget';
 
  165        $this->expectException(\InvalidArgumentException::class);
 
  166        $this->expectExceptionMessage(
"Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$target}'");
 
  178        $expectedPath = 
'testtarget/subdir';
 
  179        $target = $this->webPath . 
'/' . $expectedPath;
 
  182        $this->assertEquals($expectedPath, $result);
 
  192        $expectedPath = 
'testtarget/subdir';
 
  193        $target = $this->storagePath . 
'/' . $expectedPath;
 
  196        $this->assertEquals($expectedPath, $result);
 
  206        $target = 
'/invalid/path/to/target';
 
  208        $this->expectException(\InvalidArgumentException::class);
 
  209        $this->expectExceptionMessage(
"Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$target}'");
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
 
Customizing of pimple-DIC for ILIAS.
 
Class LegacyPathHelperTest.
 
testDeriveFilesystemFromWithStorageTargetWhichShouldSucceed()
@Test @small
 
testDeriveFilesystemFromWithRelativeLibsTargetWhichShouldSucceed()
@Test @small
 
testCreateRelativePathWithInvalidTargetWhichShouldFail()
@Test @small
 
testDeriveFilesystemFromWithInvalidTargetWhichShouldFail()
@Test @small
 
testDeriveFilesystemFromWithAbsoluteLibsTargetWhichShouldSucceed()
@Test @small
 
testDeriveFilesystemFromWithWebTargetWhichShouldSucceed()
@Test @small
 
testCreateRelativePathWithStorageTargetWhichShouldSucceed()
@Test @small
 
testCreateRelativePathWithWebTargetWhichShouldSucceed()
@Test @small
 
static createRelativePath(string $absolute_path)
Creates a relative path from an absolute path which starts with a valid storage location.
 
static deriveFilesystemFrom(string $absolute_path)
Tries to fetch the filesystem responsible for the absolute path.
 
Class FlySystemFileAccessTest \Provider\FlySystem @runTestsInSeparateProcesses @preserveGlobalState d...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...