2 declare(strict_types = 1);
19 use org\bovigo\vfs\vfsStream;
29 use TYPO3\TestingFramework\Core\FileStreamWrapper;
71 foreach ($this->testDirs as
$dir) {
73 GeneralUtility::rmdir(
$dir,
true);
118 protected function createDriver(array $driverConfiguration = [], array $mockedDriverMethods = []): LocalDriver
121 if (!isset($driverConfiguration[
'basePath'])) {
126 $mockedDriverMethods[] =
'isPathValid';
127 $driver = $this->getAccessibleMock(
129 $mockedDriverMethods,
130 [$driverConfiguration]
132 $driver->expects($this->any())
133 ->method(
'isPathValid')
135 $this->returnValue(
true)
138 $driver->setStorageUid(5);
139 $driver->processConfiguration();
140 $driver->initialize();
152 $relativeDriverConfiguration = [
153 'pathType' =>
'relative',
154 'basePath' =>
'/typo3temp/var/tests/',
156 $basePath = $subject->_call(
'calculateBasePath', $relativeDriverConfiguration);
158 $this->assertNotContains(
'//', $basePath);
169 $relativeDriverConfiguration = [
172 $basePath = $subject->_call(
'calculateBasePath', $relativeDriverConfiguration);
174 $this->assertNotContains(
'/../', $basePath);
184 $driver->expects($this->exactly(2))
185 ->method(
'sanitizeFileName')
187 $this->returnValue(
'sanitized')
189 $driver->createFolder(
'newFolder/andSubfolder',
'/',
true);
199 $driver = $this->getAccessibleMock(
206 $driver->expects($this->once())
207 ->method(
'hasCapability')
210 $this->returnValue(
true)
213 $driver->_call(
'determineBaseUrl');
214 $baseUri = $driver->_get(
'baseUri');
215 $this->assertEquals(rawurlencode(
'un encö') .
'/' . rawurlencode(
'ded %path') .
'/', $baseUri);
224 $folderIdentifier = $subject->getDefaultFolder();
225 $this->assertEquals(
'/user_upload/', $folderIdentifier);
248 $folder = $subject->getFolderInFolder(
'someSubdir',
'/someDir/');
249 $this->assertEquals(
'/someDir/someSubdir/', $folder);
259 $subject->createFolder(
'path',
'/some/folder/');
271 $createdFolder = $subject->createFolder(
'path',
'/some/folder/');
272 $this->assertEquals(
'/some/folder/path/', $createdFolder);
281 'folder name with NULL character' => [
282 'some' .
"\0" .
'Folder',
285 'folder name with directory part' => [
302 $subject->createFolder($newFolderName,
'/some/folder/');
303 $this->assertFileExists($this->
getUrlInMount(
'/some/folder/' . $expectedFolderName));
312 $this->assertEquals(
'/', substr($subject->_call(
'getAbsoluteBasePath'), -1));
321 $this->assertNotEquals(
'/', substr($subject->_call(
'getAbsoluteBasePath'), -2, 1));
331 'expectedValue' => filesize(__DIR__ .
'/Fixtures/Dummy.html'),
332 'propertyName' =>
'size'
335 'expectedValue' =>
'WILL_BE_REPLACED_BY_VFS_TIME',
336 'propertyName' =>
'atime'
339 'expectedValue' =>
'WILL_BE_REPLACED_BY_VFS_TIME',
340 'propertyName' =>
'mtime'
343 'expectedValue' =>
'WILL_BE_REPLACED_BY_VFS_TIME',
344 'propertyName' =>
'ctime'
347 'expectedValue' =>
'Dummy.html',
348 'propertyName' =>
'name'
351 'expectedValue' =>
'text/html',
352 'propertyName' =>
'mimetype'
355 'expectedValue' =>
'/Dummy.html',
356 'propertyName' =>
'identifier'
359 'expectedValue' => 5,
360 'propertyName' =>
'storage'
362 'identifier_hash' => [
363 'expectedValue' =>
'b11efa5d7c0556a65c6aa261343b9807cac993bc',
364 'propertyName' =>
'identifier_hash'
367 'expectedValue' =>
'42099b4af021e53fd8fd4e056c2568d7c2e3ffa8',
368 'propertyName' =>
'folder_hash'
381 $root = vfsStream::setup();
382 $subFolder = vfsStream::newDirectory(
'fileadmin');
383 $root->addChild($subFolder);
385 $directory = vfsStream::copyFromFileSystem(__DIR__ .
'/Fixtures/', $subFolder, 1024 * 1024);
386 if (in_array($property, [
'mtime',
'ctime',
'atime'])) {
387 $expectedValue = $directory->getChild(
'Dummy.html')->filemtime();
390 FileStreamWrapper::registerOverlayPath(
'fileadmin',
'vfs://root/fileadmin',
false);
398 FileStreamWrapper::destroy();
408 'file1.ext' =>
'asdfg'
412 $path = $subject->_call(
'getAbsolutePath',
'/someFolder/file1.ext');
413 $this->assertTrue(file_exists($path));
430 [
'getMimeTypeOfFile']
432 $this->assertTrue(file_exists($this->
getUrl(
'sourceFolder/file')));
433 $subject->addFile($this->
getUrl(
'sourceFolder/file'),
'/targetFolder/',
'file');
450 [
'getMimeTypeOfFile']
452 $this->assertTrue(file_exists($this->
getUrl(
'sourceFolder/file')));
453 $subject->addFile($this->
getUrl(
'sourceFolder/file'),
'/targetFolder/',
'targetFile');
454 $this->assertTrue(file_exists($this->
getUrlInMount(
'/targetFolder/targetFile')));
462 $this->expectException(\InvalidArgumentException::class);
463 $this->expectExceptionCode(1314778269);
470 $subject->addFile($this->
getUrlInMount(
'/targetFolder/file'),
'/targetFolder/',
'file');
486 [
'getMimeTypeOfFile']
488 $this->assertTrue(file_exists($this->
getUrl(
'sourceFolder/file')));
489 $fileIdentifier = $subject->addFile($this->
getUrl(
'sourceFolder/file'),
'/targetFolder/',
'file');
490 $this->assertEquals(
'file', basename($fileIdentifier));
491 $this->assertEquals(
'/targetFolder/file', $fileIdentifier);
505 $this->assertTrue($subject->fileExists(
'/file'));
506 $this->assertTrue($subject->folderExists(
'/folder/'));
507 $this->assertFalse($subject->fileExists(
'/nonexistingFile'));
508 $this->assertFalse($subject->folderExists(
'/nonexistingFolder/'));
523 $this->assertTrue($subject->fileExistsInFolder(
'file',
'/subfolder/'));
524 $this->assertTrue($subject->folderExistsInFolder(
'folder',
'/subfolder/'));
525 $this->assertFalse($subject->fileExistsInFolder(
'nonexistingFile',
'/subfolder/'));
526 $this->assertFalse($subject->folderExistsInFolder(
'nonexistingFolder',
'/subfolder/'));
534 $baseUri =
'http://example.org/foobar/' . $this->getUniqueId();
536 'file.ext' =>
'asdf',
538 'file2.ext' =>
'asdf'
542 'baseUri' => $baseUri
544 $this->assertEquals($baseUri .
'/file.ext', $subject->getPublicUrl(
'/file.ext'));
545 $this->assertEquals($baseUri .
'/subfolder/file2.ext', $subject->getPublicUrl(
'/subfolder/file2.ext'));
556 [
'/single file with some special chars äüö!.txt'],
557 [
'/on subfolder/with special chars äüö!.ext'],
558 [
'/who names a file like !"§$%&()=?*+~"#\'´`<>-.ext'],
559 [
'no leading slash !"§$%&()=?*+~#\'"´`"<>-.txt']
570 $baseUri =
'http://example.org/foobar/' . $this->getUniqueId();
572 'baseUri' => $baseUri
574 $publicUrl = $subject->getPublicUrl($fileIdentifier);
576 GeneralUtility::isValidUrl($publicUrl),
577 'getPublicUrl did not return a valid URL:' . $publicUrl
586 $fileContents =
'asdf';
588 'file.ext' => $fileContents
591 $this->assertEquals($fileContents, $subject->getFileContents(
'/file.ext'),
'File contents could not be read');
592 $newFileContents =
'asdfgh';
593 $subject->setFileContents(
'/file.ext', $newFileContents);
596 $subject->getFileContents(
'/file.ext'),
597 'New file contents could not be read.'
606 $fileContents =
'asdf';
608 'file.ext' => $fileContents
611 $newFileContents =
'asdfgh';
612 $bytesWritten = $subject->setFileContents(
'/file.ext', $newFileContents);
613 $this->assertEquals(strlen($newFileContents), $bytesWritten);
623 $subject->createFile(
'testfile.txt',
'/');
624 $this->assertTrue($subject->fileExists(
'/testfile.txt'));
634 $subject->createFile(
'testfile.txt',
'/');
635 $this->assertTrue($subject->fileExists(
'/testfile.txt'));
636 $fileData = $subject->getFileContents(
'/testfile.txt');
637 $this->assertEquals(0, strlen($fileData));
646 $this->markTestSkipped(
'createdFilesHaveCorrectRights() tests not available on Windows');
650 $testpattern =
'0646';
651 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'fileCreateMask'] = $testpattern;
661 $subject->createFile(
'testfile.txt',
'/someDir');
662 $this->assertEquals((
int)$testpattern, (
int)(decoct(fileperms(
$basedir .
'/someDir/testfile.txt') & 0777)));
673 $root = vfsStream::setup();
674 $subFolder = vfsStream::newDirectory(
'fileadmin');
675 $root->addChild($subFolder);
677 vfsStream::copyFromFileSystem(__DIR__ .
'/Fixtures/', $subFolder, 1024 * 1024);
679 FileStreamWrapper::registerOverlayPath(
'fileadmin/',
'vfs://root/fileadmin/',
false);
683 $subdirFileInfo = $subject->getFileInfoByIdentifier(
'Dummy.html');
684 $this->assertEquals(
'/Dummy.html', $subdirFileInfo[
'identifier']);
685 $rootFileInfo = $subject->getFileInfoByIdentifier(
'LocalDriverFilenameFilter.php');
686 $this->assertEquals(
'/LocalDriverFilenameFilter.php', $rootFileInfo[
'identifier']);
688 FileStreamWrapper::destroy();
696 $this->expectException(\InvalidArgumentException::class);
697 $this->expectExceptionCode(1314516809);
699 $subject->getFileInfoByIdentifier(
'/some/file/at/a/random/path');
708 $fileList = $subject->getFilesInFolder(
'/');
709 $this->assertEmpty($fileList);
726 [
'getMimeTypeOfFile']
728 $fileList = $subject->getFilesInFolder(
'/');
729 $this->assertEquals([
'/file1',
'/file2'], array_keys($fileList));
741 'file4' =>
'asklfjklasjkl'
751 [
'getMimeTypeOfFile']
753 $fileList = $subject->getFilesInFolder(
'/', 0, 0,
true);
754 $this->assertEquals([
'/file1',
'/file2',
'/aDir/file3',
'/aDir/subdir/file4'], array_keys($fileList));
762 $this->expectException(\InvalidArgumentException::class);
763 $this->expectExceptionCode(1314349666);
766 $subject->getFilesInFolder(
'somedir/');
781 'callbackStaticTestFunction'
787 $this->expectException(\InvalidArgumentException::class);
788 $this->expectExceptionCode(1336159604);
789 $subject->getFilesInFolder(
'/', 0, 0,
false, $callback);
803 if ($itemName ===
'file2') {
804 throw new \InvalidArgumentException(
'$itemName', 1336159604);
821 [
'getMimeTypeOfFile']
825 LocalDriverFilenameFilter::class,
829 $fileList = $subject->getFilesInFolder(
'/', 0, 0,
false, $filterCallbacks);
830 $this->assertNotContains(
'/fileA', array_keys($fileList));
845 $fileList = $subject->getFoldersInFolder(
'/');
846 $this->assertEquals([
'/dir1/',
'/dir2/'], array_keys($fileList));
855 '.someHiddenDir' => [],
862 $fileList = $subject->getFoldersInFolder(
'/');
864 $this->assertEquals([
'/.someHiddenDir/',
'/aDir/'], array_keys($fileList));
881 $fileList = $subject->getFoldersInFolder(
'/');
882 $this->assertEmpty($fileList);
898 LocalDriverFilenameFilter::class,
902 $folderList = $subject->getFoldersInFolder(
'/', 0, 0, $filterCallbacks);
903 $this->assertNotContains(
'folderA', array_keys($folderList));
911 $this->expectException(\InvalidArgumentException::class);
912 $this->expectExceptionCode(1314349666);
914 vfsStream::create([$this->basedir => [
'somefile' =>
'']]);
915 $subject->getFoldersInFolder(
'somedir/');
923 $contents =
'68b329da9893e34099c7d8ad5cb9c940';
924 $expectedMd5Hash =
'8c67dbaf0ba22f2e7fbc26413b86051b';
925 $expectedSha1Hash =
'a60cd808ba7a0bcfa37fa7f3fb5998e1b8dbcd9d';
928 $this->assertEquals($expectedSha1Hash, $subject->hash(
'/hashFile',
'sha1'));
929 $this->assertEquals($expectedMd5Hash, $subject->hash(
'/hashFile',
'md5'));
937 $this->expectException(\InvalidArgumentException::class);
938 $this->expectExceptionCode(1304964032);
940 $subject->hash(
'/hashFile', $this->getUniqueId());
949 $fileContents =
'asdfgh';
952 'someFile' => $fileContents
955 $subject = $this->
createDriver([], [
'copyFileToTemporaryPath']);
956 $subject->expects($this->once())->method(
'copyFileToTemporaryPath');
957 $subject->getFileForLocalProcessing(
'/someDir/someFile');
965 $fileContents =
'asdfgh';
968 'someFile' => $fileContents
972 $filePath = $subject->getFileForLocalProcessing(
'/someDir/someFile',
false);
981 $fileContents =
'asdfgh';
984 'someFile.ext' => $fileContents
988 $filePath = GeneralUtility::fixWindowsFilePath($subject->_call(
'copyFileToTemporaryPath',
'/someDir/someFile.ext'));
989 $this->testFilesToDelete[] = $filePath;
990 $this->assertContains(
'/typo3temp/var/transient/', $filePath);
991 $this->assertEquals($fileContents, file_get_contents($filePath));
1004 $this->assertEquals([
'r' =>
true,
'w' =>
true], $subject->getPermissions(
'/someFile'));
1012 if (\function_exists(
'posix_getegid') && posix_getegid() === 0) {
1013 $this->markTestSkipped(
'Test skipped if run on linux as root');
1015 $this->markTestSkipped(
'Test skipped if run on Windows system');
1019 touch(
$basedir .
'/someForbiddenFile');
1020 chmod(
$basedir .
'/someForbiddenFile', 0);
1022 $this->assertEquals([
'r' =>
false,
'w' =>
false], $subject->getPermissions(
'/someForbiddenFile'));
1035 $this->assertEquals([
'r' =>
true,
'w' =>
true], $subject->getPermissions(
'/someFolder'));
1043 if (function_exists(
'posix_getegid') && posix_getegid() === 0) {
1044 $this->markTestSkipped(
'Test skipped if run on linux as root');
1046 $this->markTestSkipped(
'Test skipped if run on Windows system');
1050 mkdir(
$basedir .
'/someForbiddenFolder');
1051 chmod(
$basedir .
'/someForbiddenFolder', 0);
1053 $result = $subject->getPermissions(
'/someForbiddenFolder');
1055 chmod(
$basedir .
'/someForbiddenFolder', 0777);
1056 $this->assertEquals([
'r' =>
false,
'w' =>
false], $result);
1065 $this->assertTrue($subject->isWithin(
'/someFolder/',
'/someFolder/test.jpg'));
1066 $this->assertTrue($subject->isWithin(
'/someFolder/',
'/someFolder/subFolder/test.jpg'));
1067 $this->assertFalse($subject->isWithin(
'/someFolder/',
'/someFolderWithALongName/test.jpg'));
1076 $this->assertTrue($subject->isWithin(
'/someFolder/',
'/someFolder/test.jpg'));
1077 $this->assertTrue($subject->isWithin(
'/someFolder/',
'/someFolder/subfolder/'));
1089 $fileContents = $this->getUniqueId();
1091 'someFile' => $fileContents,
1092 'targetFolder' => []
1096 [
'getMimeTypeOfFile']
1098 $subject->copyFileWithinStorage(
'/someFile',
'/targetFolder/',
'someFile');
1107 $fileContents = $this->getUniqueId();
1109 'targetFolder' => [],
1110 'someFile' => $fileContents
1113 $newIdentifier = $subject->moveFileWithinStorage(
'/someFile',
'/targetFolder/',
'file');
1114 $this->assertEquals($fileContents, file_get_contents($this->
getUrlInMount(
'/targetFolder/file')));
1116 $this->assertEquals(
'/targetFolder/file', $newIdentifier);
1124 $fileContents = $this->getUniqueId();
1126 'targetFolder' => [],
1127 'someFile' => $fileContents
1132 [
'getMimeTypeOfFile']
1134 $newIdentifier = $subject->moveFileWithinStorage(
'/someFile',
'/targetFolder/',
'file');
1135 $fileMetadata = $subject->getFileInfoByIdentifier($newIdentifier);
1136 $this->assertEquals($newIdentifier, $fileMetadata[
'identifier']);
1142 'file in subfolder' => [
1144 'targetFolder' => [
'file' =>
'']
1146 '/targetFolder/file',
1148 '/targetFolder/newFile'
1150 'file in rootfolder' => [
1173 $newIdentifier = $subject->renameFile($oldFileIdentifier, $newFileName);
1174 $this->assertFalse($subject->fileExists($oldFileIdentifier));
1175 $this->assertTrue($subject->fileExists($newIdentifier));
1176 $this->assertEquals($expectedNewIdentifier, $newIdentifier);
1184 $this->expectException(ExistingTargetFileNameException::class);
1185 $this->expectExceptionCode(1320291063);
1187 'targetFolder' => [
'file' =>
'',
'newFile' =>
'']
1190 $subject->renameFile(
'/targetFolder/file',
'newFile');
1201 'folder in root folder' => [
1209 'file in subfolder' => [
1215 '/subfolder/someFolder/',
1217 '/subfolder/newFolder/'
1231 array $filesystemStructure,
1232 string $oldFolderIdentifier,
1233 string $newFolderName,
1234 string $expectedNewIdentifier
1238 $mapping = $subject->renameFolder($oldFolderIdentifier, $newFolderName);
1239 $this->assertFalse($subject->folderExists($oldFolderIdentifier));
1240 $this->assertTrue($subject->folderExists($expectedNewIdentifier));
1241 $this->assertEquals($expectedNewIdentifier, $mapping[$oldFolderIdentifier]);
1249 $fileContents =
'asdfg';
1252 'subFolder' => [
'file' => $fileContents],
1257 $mappingInformation = $subject->renameFolder(
'/sourceFolder/',
'newFolder');
1258 $this->assertTrue(is_array($mappingInformation));
1259 $this->assertEquals(
'/newFolder/', $mappingInformation[
'/sourceFolder/']);
1260 $this->assertEquals(
'/newFolder/file2', $mappingInformation[
'/sourceFolder/file2']);
1261 $this->assertEquals(
'/newFolder/subFolder/file', $mappingInformation[
'/sourceFolder/subFolder/file']);
1262 $this->assertEquals(
'/newFolder/subFolder/', $mappingInformation[
'/sourceFolder/subFolder/']);
1270 $this->expectException(\RuntimeException::class);
1271 $this->expectExceptionCode(1334160746);
1277 $subject = $this->
createDriver([], [
'createIdentifierMap']);
1278 $subject->expects($this->atLeastOnce())->method(
'createIdentifierMap')->will(
1279 $this->throwException(
1283 $subject->renameFolder(
'/sourceFolder/',
'newFolder');
1297 $this->assertTrue($subject->isFolderEmpty(
'/emptyFolder/'));
1307 'folderWithFile' => [
1312 $this->assertFalse($subject->isFolderEmpty(
'/folderWithFile/'));
1321 'folderWithSubfolder' => [
1326 $this->assertFalse($subject->isFolderEmpty(
'/folderWithSubfolder/'));
1337 $fileContents = $this->getUniqueId();
1340 'file' => $fileContents,
1342 'targetFolder' => [],
1346 $subject->moveFolderWithinStorage(
'/sourceFolder/',
'/targetFolder/',
'someFolder');
1347 $this->assertTrue(file_exists($this->
getUrlInMount(
'/targetFolder/someFolder/')));
1348 $this->assertEquals($fileContents, file_get_contents($this->
getUrlInMount(
'/targetFolder/someFolder/file')));
1357 $fileContents =
'asdfg';
1359 'targetFolder' => [],
1361 'subFolder' => [
'file' => $fileContents],
1366 $mappingInformation = $subject->moveFolderWithinStorage(
'/sourceFolder/',
'/targetFolder/',
'sourceFolder');
1367 $this->assertEquals(
'/targetFolder/sourceFolder/file', $mappingInformation[
'/sourceFolder/file']);
1368 $this->assertEquals(
1369 '/targetFolder/sourceFolder/subFolder/file',
1370 $mappingInformation[
'/sourceFolder/subFolder/file']
1372 $this->assertEquals(
'/targetFolder/sourceFolder/subFolder/', $mappingInformation[
'/sourceFolder/subFolder/']);
1382 'file' => $this->getUniqueId(),
1384 'targetFolder' => [],
1387 $subject->moveFolderWithinStorage(
'/sourceFolder/',
'/targetFolder/',
'newFolder');
1398 'file' => $this->getUniqueId(),
1400 'targetFolder' => [],
1403 $subject->copyFolderWithinStorage(
'/sourceFolder/',
'/targetFolder/',
'newFolderName');
1404 $this->assertTrue(is_file($this->
getUrlInMount(
'/targetFolder/newFolderName/file')));
1413 GeneralUtility::mkdir_deep($basePath .
'/sourceFolder/subFolder');
1414 GeneralUtility::mkdir_deep($basePath .
'/targetFolder');
1416 $subject->copyFolderWithinStorage(
'/sourceFolder/',
'/targetFolder/',
'newFolderName');
1417 $this->assertTrue(is_dir($basePath .
'/targetFolder/newFolderName/subFolder'));
1426 GeneralUtility::mkdir_deep($basePath .
'/sourceFolder/subFolder');
1427 GeneralUtility::mkdir_deep($basePath .
'/targetFolder');
1428 file_put_contents($basePath .
'/sourceFolder/subFolder/file', $this->getUniqueId());
1429 GeneralUtility::fixPermissions($basePath .
'/sourceFolder/subFolder/file');
1431 $subject->copyFolderWithinStorage(
'/sourceFolder/',
'/targetFolder/',
'newFolderName');
1432 $this->assertTrue(is_file($basePath .
'/targetFolder/newFolderName/subFolder/file'));
1445 $this->iso88591GreaterThan127 =
'';
1446 for ($i = 0xA0; $i <= 0xFF; $i++) {
1447 $this->iso88591GreaterThan127 .= chr($i);
1453 $this->utf8Latin1Supplement =
'';
1454 for ($i = 0xA0; $i <= 0xBF; $i++) {
1455 $this->utf8Latin1Supplement .= chr(0xC2) . chr($i);
1457 for ($i = 0x80; $i <= 0xBF; $i++) {
1458 $this->utf8Latin1Supplement .= chr(0xC3) . chr($i);
1462 $this->utf8Latin1ExtendedA =
'';
1463 for ($i = 0x80; $i <= 0xBF; $i++) {
1464 $this->utf8Latin1ExtendedA .= chr(0xC4) . chr($i);
1466 for ($i = 0x80; $i <= 0xBF; $i++) {
1467 $this->utf8Latin1ExtendedA .= chr(0xC5) . chr($i);
1486 'allowed characters utf-8 (ASCII part)' => [
1487 '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1488 '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
1491 'replace special characters with _ (not allowed characters) utf-8 (ASCII part)' => [
1492 '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1493 '_____________________________'
1495 'utf-8 (Latin-1 Supplement)' => [
1497 '________________________________ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'
1499 'trim leading and tailing spaces utf-8' => [
1503 'remove tailing dot' => [
1518 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'UTF8filesystem'] = 1;
1519 $this->assertEquals(
1540 'allowed characters iso-8859-1' => [
1541 '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1543 '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
1546 'allowed characters utf-8' => [
1547 '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1549 '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
1552 'replace special characters with _ (not allowed characters) iso-8859-1' => [
1553 '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1555 '_____________________________'
1558 'replace special characters with _ (not allowed characters) utf-8' => [
1559 '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1561 '_____________________________'
1563 'iso-8859-1 (code > 127)' => [
1568 '_centpound_yen____c_a_____R_____-23_u___1o__1_41_23_4_AAAAAEAAAECEEEEIIIIDNOOOOOExOEUUUUEYTHssaaaaaeaaaeceeeeiiiidnoooooe_oeuuuueythy'
1570 'utf-8 (Latin-1 Supplement)' => [
1574 '_centpound__yen______c_a_______R_______-23__u_____1o__1_41_23_4_AAAAAEAAAECEEEEIIIIDNOOOOOExOEUUUUEYTHssaaaaaeaaaeceeeeiiiidnoooooe_oeuuuueythy'
1576 'utf-8 (Latin-1 Extended A)' => [
1579 'AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIJijJjKk__LlLlLlL_l_LlNnNnNn_n____OOooOoOoOEoeRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs'
1581 'trim leading and tailing spaces iso-8859-1' => [
1586 'trim leading and tailing spaces utf-8' => [
1591 'remove tailing dot iso-8859-1' => [
1596 'remove tailing dot utf-8' => [
1613 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'UTF8filesystem'] = 0;
1614 $this->assertEquals(
1616 $this->
createDriver()->sanitizeFileName($fileName, $charset)
1625 $this->expectException(InvalidFileNameException::class);
1626 $this->expectExceptionCode(1320288991);
1628 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'UTF8filesystem'] = 1;
1637 $this->expectException(\Exception::class);
1638 $this->expectExceptionCode(1463073434);
1639 $closure =
function () {
1640 throw new \Exception(
'I was called!', 1463073434);
1647 $this->
createDriver()->_call(
'applyFilterMethodsToDirectoryItem', $filterMethods,
'',
'',
'');
1655 $dummyObject = $this
1656 ->getMockBuilder(LocalDriver::class)
1657 ->setMethods([
'dummy'])
1658 ->disableOriginalConstructor()
1664 $dummyObject->expects($this->once())->method(
'dummy');
1668 $this->
createDriver()->_call(
'applyFilterMethodsToDirectoryItem', $filterMethods,
'',
'',
'');