5require_once(
'./libs/composer/vendor/autoload.php');
 
   11use Mockery\MockInterface;
 
   12use PHPUnit\Framework\TestCase;
 
   45        $dataDir = 
'/dummy/var/www/ildata';
 
   50        define(
"CLIENT_DATA_DIR", $dataDir . 
'/' . 
$clientId);
 
   53        define(
"ILIAS_WEB_DIR", $webDir);
 
   54        define(
"CLIENT_ID", 
'default');
 
   58        $this->webPath = CLIENT_WEB_DIR;
 
   59        $this->storagePath = CLIENT_DATA_DIR;
 
   60        $this->tempPath = sys_get_temp_dir();
 
   63        $this->filesystemsMock = \Mockery::mock(Filesystems::class);
 
   65        $containerMock = Mockery::mock(Container::class);
 
   66        $containerMock->shouldReceive(
'filesystem')
 
   69            ->andReturn($this->filesystemsMock);
 
   81        $target = $this->webPath . 
'/testtarget';
 
   83        $this->filesystemsMock
 
   84            ->shouldReceive(
'web')
 
   86            ->andReturn(Mockery::mock(Filesystem::class));
 
   89        $this->assertTrue($filesystem instanceof 
Filesystem, 
'Expecting filesystem instance.');
 
   99        $target = $this->storagePath . 
'/testtarget';
 
  101        $this->filesystemsMock
 
  102            ->shouldReceive(
'storage')
 
  104            ->andReturn(Mockery::mock(Filesystem::class));
 
  107        $this->assertTrue($filesystem instanceof 
Filesystem, 
'Expecting filesystem instance.');
 
  117        $target = 
'./libs/bower/bower_components/mediaelement/build';
 
  119        $this->filesystemsMock
 
  120            ->shouldReceive(
'libs')
 
  122            ->andReturn(Mockery::mock(Filesystem::class));
 
  125        $this->assertTrue($filesystem instanceof 
Filesystem, 
'Expecting filesystem instance.');
 
  134        $target = $this->libsPath . 
'libs/bower/bower_components/mediaelement/build';
 
  136        $this->filesystemsMock
 
  137            ->shouldReceive(
'libs')
 
  139            ->andReturn(Mockery::mock(Filesystem::class));
 
  142        $this->assertTrue($filesystem instanceof 
Filesystem, 
'Expecting filesystem instance.');
 
  152        $target = 
'/invalid/path/to/testtarget';
 
  154        $this->expectException(\InvalidArgumentException::class);
 
  155        $this->expectExceptionMessage(
"Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$target}'");
 
  167        $expectedPath = 
'testtarget/subdir';
 
  168        $target = $this->webPath . 
'/' . $expectedPath;
 
  171        $this->assertEquals($expectedPath, 
$result);
 
  181        $expectedPath = 
'testtarget/subdir';
 
  182        $target = $this->storagePath . 
'/' . $expectedPath;
 
  185        $this->assertEquals($expectedPath, 
$result);
 
  195        $target = 
'/invalid/path/to/target';
 
  197        $this->expectException(\InvalidArgumentException::class);
 
  198        $this->expectExceptionMessage(
"Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$target}'");
 
An exception for terminatinating execution or to throw for unit testing.
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 deriveFilesystemFrom($absolute_path)
Tries to fetch the filesystem responsible for the absolute path.
static createRelativePath($absolute_path)
Creates a relative path from an absolute path which starts with a valid storage location.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Class FlySystemFileAccessTest.