‪TYPO3CMS  9.5
LocalDriverTest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
19 use org\bovigo\vfs\vfsStream;
29 use TYPO3\TestingFramework\Core\FileStreamWrapper;
30 
35 {
39  protected ‪$resetSingletonInstances = true;
40 
44  protected ‪$localDriver;
45 
49  protected ‪$testDirs = [];
50 
55 
59  protected ‪$utf8Latin1Supplement = '';
60 
64  protected ‪$utf8Latin1ExtendedA = '';
65 
69  protected function ‪tearDown(): void
70  {
71  foreach ($this->testDirs as ‪$dir) {
72  chmod(‪$dir, 0777);
73  GeneralUtility::rmdir(‪$dir, true);
74  }
75  parent::tearDown();
76  }
77 
86  protected function ‪createRealTestdir(): string
87  {
88  ‪$basedir = ‪Environment::getVarPath() . '/tests/' . $this->getUniqueId('fal-test-');
89  mkdir(‪$basedir);
90  $this->testDirs[] = ‪$basedir;
91  return ‪$basedir;
92  }
93 
100  protected function ‪prepareRealTestEnvironment(): array
101  {
103  $subject = $this->‪createDriver([
104  'basePath' => ‪$basedir
105  ]);
106  return [‪$basedir, $subject];
107  }
108 
118  protected function ‪createDriver(array $driverConfiguration = [], array $mockedDriverMethods = []): LocalDriver
119  {
120  // it's important to do that here, so vfsContents could have been set before
121  if (!isset($driverConfiguration['basePath'])) {
122  $this->‪initializeVfs();
123  $driverConfiguration['basePath'] = $this->‪getMountRootUrl();
124  }
126  $mockedDriverMethods[] = 'isPathValid';
127  $driver = $this->getAccessibleMock(
128  LocalDriver::class,
129  $mockedDriverMethods,
130  [$driverConfiguration]
131  );
132  $driver->expects($this->any())
133  ->method('isPathValid')
134  ->will(
135  $this->returnValue(true)
136  );
137 
138  $driver->setStorageUid(5);
139  $driver->processConfiguration();
140  $driver->initialize();
141  return $driver;
142  }
143 
147  public function ‪calculatedBasePathRelativeIsSane(): void
148  {
149  $subject = $this->‪createDriver();
150 
151  // This would cause problems if you fill "/fileadmin/" into the base path field of a sys_file_storage record and select "relative" as path type
152  $relativeDriverConfiguration = [
153  'pathType' => 'relative',
154  'basePath' => '/typo3temp/var/tests/',
155  ];
156  $basePath = $subject->_call('calculateBasePath', $relativeDriverConfiguration);
157 
158  $this->assertNotContains('//', $basePath);
159  }
160 
164  public function ‪calculatedBasePathAbsoluteIsSane(): void
165  {
166  $subject = $this->‪createDriver();
167 
168  // This test checks if "/../" are properly filtered out (i.e. from "Base path" field of sys_file_storage)
169  $relativeDriverConfiguration = [
170  'basePath' => ‪Environment::getVarPath() . '/tests/../../../typo3temp/var/tests/',
171  ];
172  $basePath = $subject->_call('calculateBasePath', $relativeDriverConfiguration);
173 
174  $this->assertNotContains('/../', $basePath);
175  }
176 
180  public function ‪createFolderRecursiveSanitizesFilename(): void
181  {
183  $driver = $this->‪createDriver([], ['sanitizeFilename']);
184  $driver->expects($this->exactly(2))
185  ->method('sanitizeFileName')
186  ->will(
187  $this->returnValue('sanitized')
188  );
189  $driver->createFolder('newFolder/andSubfolder', '/', true);
190  $this->assertFileExists($this->‪getUrlInMount('/sanitized/sanitized/'));
191  }
192 
196  public function ‪determineBaseUrlUrlEncodesUriParts(): void
197  {
199  $driver = $this->getAccessibleMock(
200  LocalDriver::class,
201  ['hasCapability'],
202  [],
203  '',
204  false
205  );
206  $driver->expects($this->once())
207  ->method('hasCapability')
209  ->will(
210  $this->returnValue(true)
211  );
212  $driver->_set('absoluteBasePath', ‪Environment::getPublicPath() . '/un encö/ded %path/');
213  $driver->_call('determineBaseUrl');
214  $baseUri = $driver->_get('baseUri');
215  $this->assertEquals(rawurlencode('un encö') . '/' . rawurlencode('ded %path') . '/', $baseUri);
216  }
217 
222  {
223  $subject = $this->‪createDriver();
224  $folderIdentifier = $subject->getDefaultFolder();
225  $this->assertEquals('/user_upload/', $folderIdentifier);
226  }
227 
232  {
233  $subject = $this->‪createDriver();
234  $this->assertFileExists($this->‪getUrlInMount($subject->getDefaultFolder()));
235  }
236 
240  public function ‪getFolderInFolderReturnsCorrectFolderObject(): void
241  {
242  $this->‪addToMount([
243  'someDir' => [
244  'someSubdir' => []
245  ]
246  ]);
247  $subject = $this->‪createDriver();
248  $folder = $subject->getFolderInFolder('someSubdir', '/someDir/');
249  $this->assertEquals('/someDir/someSubdir/', $folder);
250  }
251 
255  public function ‪createFolderCreatesFolderOnDisk(): void
256  {
257  $this->‪addToMount(['some' => ['folder' => []]]);
258  $subject = $this->‪createDriver();
259  $subject->createFolder('path', '/some/folder/');
260  $this->assertFileExists($this->‪getUrlInMount('/some/folder/'));
261  $this->assertFileExists($this->‪getUrlInMount('/some/folder/path'));
262  }
263 
267  public function ‪createFolderReturnsFolderObject(): void
268  {
269  $this->‪addToMount(['some' => ['folder' => []]]);
270  $subject = $this->‪createDriver();
271  $createdFolder = $subject->createFolder('path', '/some/folder/');
272  $this->assertEquals('/some/folder/path/', $createdFolder);
273  }
274 
279  {
280  return [
281  'folder name with NULL character' => [
282  'some' . "\0" . 'Folder',
283  'some_Folder'
284  ],
285  'folder name with directory part' => [
286  '../someFolder',
287  '.._someFolder'
288  ]
289  ];
290  }
291 
298  public function ‪createFolderSanitizesFolderNameBeforeCreation(string $newFolderName, string $expectedFolderName): void
299  {
300  $this->‪addToMount(['some' => ['folder' => []]]);
301  $subject = $this->‪createDriver();
302  $subject->createFolder($newFolderName, '/some/folder/');
303  $this->assertFileExists($this->‪getUrlInMount('/some/folder/' . $expectedFolderName));
304  }
305 
309  public function ‪basePathIsNormalizedWithTrailingSlash(): void
310  {
311  $subject = $this->‪createDriver();
312  $this->assertEquals('/', substr($subject->_call('getAbsoluteBasePath'), -1));
313  }
314 
319  {
320  $subject = $this->‪createDriver();
321  $this->assertNotEquals('/', substr($subject->_call('getAbsoluteBasePath'), -2, 1));
322  }
323 
327  public function ‪getSpecificFileInformationDataProvider(): array
328  {
329  return [
330  'size' => [
331  'expectedValue' => filesize(__DIR__ . '/Fixtures/Dummy.html'),
332  'propertyName' => 'size'
333  ],
334  'atime' => [
335  'expectedValue' => 'WILL_BE_REPLACED_BY_VFS_TIME',
336  'propertyName' => 'atime'
337  ],
338  'mtime' => [
339  'expectedValue' => 'WILL_BE_REPLACED_BY_VFS_TIME',
340  'propertyName' => 'mtime'
341  ],
342  'ctime' => [
343  'expectedValue' => 'WILL_BE_REPLACED_BY_VFS_TIME',
344  'propertyName' => 'ctime'
345  ],
346  'name' => [
347  'expectedValue' => 'Dummy.html',
348  'propertyName' => 'name'
349  ],
350  'mimetype' => [
351  'expectedValue' => 'text/html',
352  'propertyName' => 'mimetype'
353  ],
354  'identifier' => [
355  'expectedValue' => '/Dummy.html',
356  'propertyName' => 'identifier'
357  ],
358  'storage' => [
359  'expectedValue' => 5,
360  'propertyName' => 'storage'
361  ],
362  'identifier_hash' => [
363  'expectedValue' => 'b11efa5d7c0556a65c6aa261343b9807cac993bc',
364  'propertyName' => 'identifier_hash'
365  ],
366  'folder_hash' => [
367  'expectedValue' => '42099b4af021e53fd8fd4e056c2568d7c2e3ffa8',
368  'propertyName' => 'folder_hash'
369  ]
370  ];
371  }
372 
379  public function ‪getSpecificFileInformationReturnsRequestedFileInformation($expectedValue, string $property): void
380  {
381  $root = vfsStream::setup();
382  $subFolder = vfsStream::newDirectory('fileadmin');
383  $root->addChild($subFolder);
384  // Load fixture files and folders from disk
385  $directory = vfsStream::copyFromFileSystem(__DIR__ . '/Fixtures/', $subFolder, 1024 * 1024);
386  if (in_array($property, ['mtime', 'ctime', 'atime'])) {
387  $expectedValue = $directory->getChild('Dummy.html')->filemtime();
388  }
389  FileStreamWrapper::init(‪Environment::getPublicPath() . '/');
390  FileStreamWrapper::registerOverlayPath('fileadmin', 'vfs://root/fileadmin', false);
391 
392  $subject = $this->‪createDriver(['basePath' => ‪Environment::getPublicPath() . '/fileadmin']);
393  $this->assertSame(
394  $expectedValue,
395  $subject->getSpecificFileInformation(‪Environment::getPublicPath() . '/fileadmin/Dummy.html', '/', $property)
396  );
397 
398  FileStreamWrapper::destroy();
399  }
400 
404  public function ‪getAbsolutePathReturnsCorrectPath(): void
405  {
406  $this->‪addToMount([
407  'someFolder' => [
408  'file1.ext' => 'asdfg'
409  ]
410  ]);
411  $subject = $this->‪createDriver();
412  $path = $subject->_call('getAbsolutePath', '/someFolder/file1.ext');
413  $this->assertTrue(file_exists($path));
414  $this->assertEquals($this->‪getUrlInMount('/someFolder/file1.ext'), $path);
415  }
416 
420  public function ‪addFileMovesFileToCorrectLocation(): void
421  {
422  $this->‪addToMount(['targetFolder' => []]);
423  $this->‪addToVfs([
424  'sourceFolder' => [
425  'file' => 'asdf'
426  ]
427  ]);
428  $subject = $this->‪createDriver(
429  [],
430  ['getMimeTypeOfFile']
431  );
432  $this->assertTrue(file_exists($this->‪getUrl('sourceFolder/file')));
433  $subject->addFile($this->‪getUrl('sourceFolder/file'), '/targetFolder/', 'file');
434  $this->assertTrue(file_exists($this->‪getUrlInMount('/targetFolder/file')));
435  }
436 
440  public function ‪addFileUsesFilenameIfGiven(): void
441  {
442  $this->‪addToMount(['targetFolder' => []]);
443  $this->‪addToVfs([
444  'sourceFolder' => [
445  'file' => 'asdf'
446  ]
447  ]);
448  $subject = $this->‪createDriver(
449  [],
450  ['getMimeTypeOfFile']
451  );
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')));
455  }
456 
460  public function ‪addFileFailsIfFileIsInDriverStorage(): void
461  {
462  $this->expectException(\InvalidArgumentException::class);
463  $this->expectExceptionCode(1314778269);
464  $this->‪addToMount([
465  'targetFolder' => [
466  'file' => 'asdf'
467  ]
468  ]);
469  $subject = $this->‪createDriver();
470  $subject->addFile($this->‪getUrlInMount('/targetFolder/file'), '/targetFolder/', 'file');
471  }
472 
476  public function ‪addFileReturnsFileIdentifier(): void
477  {
478  $this->‪addToMount(['targetFolder' => []]);
479  $this->‪addToVfs([
480  'sourceFolder' => [
481  'file' => 'asdf'
482  ]
483  ]);
484  $subject = $this->‪createDriver(
485  [],
486  ['getMimeTypeOfFile']
487  );
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);
492  }
493 
497  public function ‪existenceChecksWorkForFilesAndFolders(): void
498  {
499  $this->‪addToMount([
500  'file' => 'asdf',
501  'folder' => []
502  ]);
503  $subject = $this->‪createDriver();
504  // Using slashes at the beginning of paths because they will be stored in the DB this way.
505  $this->assertTrue($subject->fileExists('/file'));
506  $this->assertTrue($subject->folderExists('/folder/'));
507  $this->assertFalse($subject->fileExists('/nonexistingFile'));
508  $this->assertFalse($subject->folderExists('/nonexistingFolder/'));
509  }
510 
515  {
516  $this->‪addToMount([
517  'subfolder' => [
518  'file' => 'asdf',
519  'folder' => []
520  ]
521  ]);
522  $subject = $this->‪createDriver();
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/'));
527  }
528 
533  {
534  $baseUri = 'http://example.org/foobar/' . $this->getUniqueId();
535  $this->‪addToMount([
536  'file.ext' => 'asdf',
537  'subfolder' => [
538  'file2.ext' => 'asdf'
539  ]
540  ]);
541  $subject = $this->‪createDriver([
542  'baseUri' => $baseUri
543  ]);
544  $this->assertEquals($baseUri . '/file.ext', $subject->getPublicUrl('/file.ext'));
545  $this->assertEquals($baseUri . '/subfolder/file2.ext', $subject->getPublicUrl('/subfolder/file2.ext'));
546  }
547 
554  {
555  return [
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']
560  ];
561  }
562 
568  public function ‪getPublicUrlReturnsValidUrlContainingSpecialCharacters(string $fileIdentifier): void
569  {
570  $baseUri = 'http://example.org/foobar/' . $this->getUniqueId();
571  $subject = $this->‪createDriver([
572  'baseUri' => $baseUri
573  ]);
574  $publicUrl = $subject->getPublicUrl($fileIdentifier);
575  $this->assertTrue(
576  GeneralUtility::isValidUrl($publicUrl),
577  'getPublicUrl did not return a valid URL:' . $publicUrl
578  );
579  }
580 
584  public function ‪fileContentsCanBeWrittenAndRead(): void
585  {
586  $fileContents = 'asdf';
587  $this->‪addToMount([
588  'file.ext' => $fileContents
589  ]);
590  $subject = $this->‪createDriver();
591  $this->assertEquals($fileContents, $subject->getFileContents('/file.ext'), 'File contents could not be read');
592  $newFileContents = 'asdfgh';
593  $subject->setFileContents('/file.ext', $newFileContents);
594  $this->assertEquals(
595  $newFileContents,
596  $subject->getFileContents('/file.ext'),
597  'New file contents could not be read.'
598  );
599  }
600 
605  {
606  $fileContents = 'asdf';
607  $this->‪addToMount([
608  'file.ext' => $fileContents
609  ]);
610  $subject = $this->‪createDriver();
611  $newFileContents = 'asdfgh';
612  $bytesWritten = $subject->setFileContents('/file.ext', $newFileContents);
613  $this->assertEquals(strlen($newFileContents), $bytesWritten);
614  }
615 
620  public function ‪newFilesCanBeCreated(): void
621  {
622  $subject = $this->‪createDriver();
623  $subject->createFile('testfile.txt', '/');
624  $this->assertTrue($subject->fileExists('/testfile.txt'));
625  }
626 
631  public function ‪createdFilesAreEmpty(): void
632  {
633  $subject = $this->‪createDriver();
634  $subject->createFile('testfile.txt', '/');
635  $this->assertTrue($subject->fileExists('/testfile.txt'));
636  $fileData = $subject->getFileContents('/testfile.txt');
637  $this->assertEquals(0, strlen($fileData));
638  }
639 
643  public function ‪createFileFixesPermissionsOnCreatedFile(): void
644  {
646  $this->markTestSkipped('createdFilesHaveCorrectRights() tests not available on Windows');
647  }
648 
649  // No one will use this as his default file create mask so we hopefully don't get any false positives
650  $testpattern = '0646';
651  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = $testpattern;
652 
653  $this->‪addToMount(
654  [
655  'someDir' => []
656  ]
657  );
659  [‪$basedir, $subject] = $this->‪prepareRealTestEnvironment();
660  mkdir(‪$basedir . '/someDir');
661  $subject->createFile('testfile.txt', '/someDir');
662  $this->assertEquals((int)$testpattern, (int)(decoct(fileperms(‪$basedir . '/someDir/testfile.txt') & 0777)));
663  }
664 
665  /**********************************
666  * File and directory listing
667  **********************************/
671  public function ‪getFileReturnsCorrectIdentifier(): void
672  {
673  $root = vfsStream::setup();
674  $subFolder = vfsStream::newDirectory('fileadmin');
675  $root->addChild($subFolder);
676  // Load fixture files and folders from disk
677  vfsStream::copyFromFileSystem(__DIR__ . '/Fixtures/', $subFolder, 1024 * 1024);
678  FileStreamWrapper::init(‪Environment::getPublicPath() . '/');
679  FileStreamWrapper::registerOverlayPath('fileadmin/', 'vfs://root/fileadmin/', false);
680 
681  $subject = $this->‪createDriver(['basePath' => ‪Environment::getPublicPath() . '/fileadmin']);
682 
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']);
687 
688  FileStreamWrapper::destroy();
689  }
690 
694  public function ‪getFileThrowsExceptionIfFileDoesNotExist(): void
695  {
696  $this->expectException(\InvalidArgumentException::class);
697  $this->expectExceptionCode(1314516809);
698  $subject = $this->‪createDriver();
699  $subject->getFileInfoByIdentifier('/some/file/at/a/random/path');
700  }
701 
706  {
707  $subject = $this->‪createDriver();
708  $fileList = $subject->getFilesInFolder('/');
709  $this->assertEmpty($fileList);
710  }
711 
715  public function ‪getFileListReturnsAllFilesInDirectory(): void
716  {
717  $dirStructure = [
718  'aDir' => [],
719  'file1' => 'asdfg',
720  'file2' => 'fdsa'
721  ];
722  $this->‪addToMount($dirStructure);
723  $subject = $this->‪createDriver(
724  [],
725  // Mocked because finfo() can not deal with vfs streams and throws warnings
726  ['getMimeTypeOfFile']
727  );
728  $fileList = $subject->getFilesInFolder('/');
729  $this->assertEquals(['/file1', '/file2'], array_keys($fileList));
730  }
731 
736  {
737  $dirStructure = [
738  'aDir' => [
739  'file3' => 'asdfgh',
740  'subdir' => [
741  'file4' => 'asklfjklasjkl'
742  ]
743  ],
744  'file1' => 'asdfg',
745  'file2' => 'fdsa'
746  ];
747  $this->‪addToMount($dirStructure);
748  $subject = $this->‪createDriver(
749  [],
750  // Mocked because finfo() can not deal with vfs streams and throws warnings
751  ['getMimeTypeOfFile']
752  );
753  $fileList = $subject->getFilesInFolder('/', 0, 0, true);
754  $this->assertEquals(['/file1', '/file2', '/aDir/file3', '/aDir/subdir/file4'], array_keys($fileList));
755  }
756 
760  public function ‪getFileListFailsIfDirectoryDoesNotExist(): void
761  {
762  $this->expectException(\InvalidArgumentException::class);
763  $this->expectExceptionCode(1314349666);
764  $this->‪addToMount(['somefile' => '']);
765  $subject = $this->‪createDriver();
766  $subject->getFilesInFolder('somedir/');
767  }
768 
773  {
774  $dirStructure = [
775  'file2' => 'fdsa'
776  ];
777  // register static callback to self
778  $callback = [
779  [
780  static::class,
781  'callbackStaticTestFunction'
782  ]
783  ];
784  $this->‪addToMount($dirStructure);
785  $subject = $this->‪createDriver();
786  // the callback function will throw an exception used to check if it was called with correct $itemName
787  $this->expectException(\InvalidArgumentException::class);
788  $this->expectExceptionCode(1336159604);
789  $subject->getFilesInFolder('/', 0, 0, false, $callback);
790  }
791 
801  public static function ‪callbackStaticTestFunction(string $itemName): void
802  {
803  if ($itemName === 'file2') {
804  throw new \InvalidArgumentException('$itemName', 1336159604);
805  }
806  }
807 
812  {
813  $dirStructure = [
814  'fileA' => 'asdfg',
815  'fileB' => 'fdsa'
816  ];
817  $this->‪addToMount($dirStructure);
818  $subject = $this->‪createDriver(
819  [],
820  // Mocked because finfo() can not deal with vfs streams and throws warnings
821  ['getMimeTypeOfFile']
822  );
823  $filterCallbacks = [
824  [
825  LocalDriverFilenameFilter::class,
826  'filterFilename',
827  ],
828  ];
829  $fileList = $subject->getFilesInFolder('/', 0, 0, false, $filterCallbacks);
830  $this->assertNotContains('/fileA', array_keys($fileList));
831  }
832 
837  {
838  $dirStructure = [
839  'dir1' => [],
840  'dir2' => [],
841  'file' => 'asdfg'
842  ];
843  $this->‪addToMount($dirStructure);
844  $subject = $this->‪createDriver();
845  $fileList = $subject->getFoldersInFolder('/');
846  $this->assertEquals(['/dir1/', '/dir2/'], array_keys($fileList));
847  }
848 
852  public function ‪getFolderListReturnsHiddenFoldersByDefault(): void
853  {
854  $dirStructure = [
855  '.someHiddenDir' => [],
856  'aDir' => [],
857  'file1' => ''
858  ];
859  $this->‪addToMount($dirStructure);
860  $subject = $this->‪createDriver();
861 
862  $fileList = $subject->getFoldersInFolder('/');
863 
864  $this->assertEquals(['/.someHiddenDir/', '/aDir/'], array_keys($fileList));
865  }
866 
872  public function ‪getFolderListLeavesOutNavigationalEntries(): void
873  {
874  // we have to add .. and . manually, as these are not included in vfsStream directory listings (as opposed
875  // to normal filelistings)
876  $this->‪addToMount([
877  '..' => [],
878  '.' => []
879  ]);
880  $subject = $this->‪createDriver();
881  $fileList = $subject->getFoldersInFolder('/');
882  $this->assertEmpty($fileList);
883  }
884 
889  {
890  $dirStructure = [
891  'folderA' => [],
892  'folderB' => []
893  ];
894  $this->‪addToMount($dirStructure);
895  $subject = $this->‪createDriver();
896  $filterCallbacks = [
897  [
898  LocalDriverFilenameFilter::class,
899  'filterFilename',
900  ],
901  ];
902  $folderList = $subject->getFoldersInFolder('/', 0, 0, $filterCallbacks);
903  $this->assertNotContains('folderA', array_keys($folderList));
904  }
905 
909  public function ‪getFolderListFailsIfDirectoryDoesNotExist(): void
910  {
911  $this->expectException(\InvalidArgumentException::class);
912  $this->expectExceptionCode(1314349666);
913  $subject = $this->‪createDriver();
914  vfsStream::create([$this->basedir => ['somefile' => '']]);
915  $subject->getFoldersInFolder('somedir/');
916  }
917 
921  public function ‪hashReturnsCorrectHashes(): void
922  {
923  $contents = '68b329da9893e34099c7d8ad5cb9c940';
924  $expectedMd5Hash = '8c67dbaf0ba22f2e7fbc26413b86051b';
925  $expectedSha1Hash = 'a60cd808ba7a0bcfa37fa7f3fb5998e1b8dbcd9d';
926  $this->‪addToMount(['hashFile' => $contents]);
927  $subject = $this->‪createDriver();
928  $this->assertEquals($expectedSha1Hash, $subject->hash('/hashFile', 'sha1'));
929  $this->assertEquals($expectedMd5Hash, $subject->hash('/hashFile', 'md5'));
930  }
931 
935  public function ‪hashingWithUnsupportedAlgorithmFails(): void
936  {
937  $this->expectException(\InvalidArgumentException::class);
938  $this->expectExceptionCode(1304964032);
939  $subject = $this->‪createDriver();
940  $subject->hash('/hashFile', $this->getUniqueId());
941  }
942 
948  {
949  $fileContents = 'asdfgh';
950  $this->‪addToMount([
951  'someDir' => [
952  'someFile' => $fileContents
953  ]
954  ]);
955  $subject = $this->‪createDriver([], ['copyFileToTemporaryPath']);
956  $subject->expects($this->once())->method('copyFileToTemporaryPath');
957  $subject->getFileForLocalProcessing('/someDir/someFile');
958  }
959 
964  {
965  $fileContents = 'asdfgh';
966  $this->‪addToMount([
967  'someDir' => [
968  'someFile' => $fileContents
969  ]
970  ]);
971  $subject = $this->‪createDriver();
972  $filePath = $subject->getFileForLocalProcessing('/someDir/someFile', false);
973  $this->assertEquals($filePath, $this->‪getUrlInMount('someDir/someFile'));
974  }
975 
979  public function ‪filesCanBeCopiedToATemporaryPath(): void
980  {
981  $fileContents = 'asdfgh';
982  $this->‪addToMount([
983  'someDir' => [
984  'someFile.ext' => $fileContents
985  ]
986  ]);
987  $subject = $this->‪createDriver();
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));
992  }
993 
998  {
1000  [‪$basedir, $subject] = $this->‪prepareRealTestEnvironment();
1001  touch(‪$basedir . '/someFile');
1002  chmod(‪$basedir . '/someFile', 448);
1003  clearstatcache();
1004  $this->assertEquals(['r' => true, 'w' => true], $subject->getPermissions('/someFile'));
1005  }
1006 
1011  {
1012  if (\function_exists('posix_getegid') && posix_getegid() === 0) {
1013  $this->markTestSkipped('Test skipped if run on linux as root');
1014  } elseif (‪Environment::isWindows()) {
1015  $this->markTestSkipped('Test skipped if run on Windows system');
1016  }
1018  [‪$basedir, $subject] = $this->‪prepareRealTestEnvironment();
1019  touch(‪$basedir . '/someForbiddenFile');
1020  chmod(‪$basedir . '/someForbiddenFile', 0);
1021  clearstatcache();
1022  $this->assertEquals(['r' => false, 'w' => false], $subject->getPermissions('/someForbiddenFile'));
1023  }
1024 
1029  {
1031  [‪$basedir, $subject] = $this->‪prepareRealTestEnvironment();
1032  mkdir(‪$basedir . '/someFolder');
1033  chmod(‪$basedir . '/someFolder', 448);
1034  clearstatcache();
1035  $this->assertEquals(['r' => true, 'w' => true], $subject->getPermissions('/someFolder'));
1036  }
1037 
1042  {
1043  if (function_exists('posix_getegid') && posix_getegid() === 0) {
1044  $this->markTestSkipped('Test skipped if run on linux as root');
1045  } elseif (‪Environment::isWindows()) {
1046  $this->markTestSkipped('Test skipped if run on Windows system');
1047  }
1049  [‪$basedir, $subject] = $this->‪prepareRealTestEnvironment();
1050  mkdir(‪$basedir . '/someForbiddenFolder');
1051  chmod(‪$basedir . '/someForbiddenFolder', 0);
1052  clearstatcache();
1053  $result = $subject->getPermissions('/someForbiddenFolder');
1054  // Change permissions back to writable, so the sub-folder can be removed in tearDown
1055  chmod(‪$basedir . '/someForbiddenFolder', 0777);
1056  $this->assertEquals(['r' => false, 'w' => false], $result);
1057  }
1058 
1063  {
1064  $subject = $this->‪createDriver();
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'));
1068  }
1069 
1073  public function ‪isWithinAcceptsFileAndFolderObjectsAsContent(): void
1074  {
1075  $subject = $this->‪createDriver();
1076  $this->assertTrue($subject->isWithin('/someFolder/', '/someFolder/test.jpg'));
1077  $this->assertTrue($subject->isWithin('/someFolder/', '/someFolder/subfolder/'));
1078  }
1079 
1080  /**********************************
1081  * Copy/move file
1082  **********************************/
1083 
1087  public function ‪filesCanBeCopiedWithinStorage(): void
1088  {
1089  $fileContents = $this->getUniqueId();
1090  $this->‪addToMount([
1091  'someFile' => $fileContents,
1092  'targetFolder' => []
1093  ]);
1094  $subject = $this->‪createDriver(
1095  [],
1096  ['getMimeTypeOfFile']
1097  );
1098  $subject->copyFileWithinStorage('/someFile', '/targetFolder/', 'someFile');
1099  $this->assertFileEquals($this->‪getUrlInMount('/someFile'), $this->‪getUrlInMount('/targetFolder/someFile'));
1100  }
1101 
1105  public function ‪filesCanBeMovedWithinStorage(): void
1106  {
1107  $fileContents = $this->getUniqueId();
1108  $this->‪addToMount([
1109  'targetFolder' => [],
1110  'someFile' => $fileContents
1111  ]);
1112  $subject = $this->‪createDriver();
1113  $newIdentifier = $subject->moveFileWithinStorage('/someFile', '/targetFolder/', 'file');
1114  $this->assertEquals($fileContents, file_get_contents($this->‪getUrlInMount('/targetFolder/file')));
1115  $this->assertFileNotExists($this->‪getUrlInMount('/someFile'));
1116  $this->assertEquals('/targetFolder/file', $newIdentifier);
1117  }
1118 
1122  public function ‪fileMetadataIsChangedAfterMovingFile(): void
1123  {
1124  $fileContents = $this->getUniqueId();
1125  $this->‪addToMount([
1126  'targetFolder' => [],
1127  'someFile' => $fileContents
1128  ]);
1129  $subject = $this->‪createDriver(
1130  [],
1131  // Mocked because finfo() can not deal with vfs streams and throws warnings
1132  ['getMimeTypeOfFile']
1133  );
1134  $newIdentifier = $subject->moveFileWithinStorage('/someFile', '/targetFolder/', 'file');
1135  $fileMetadata = $subject->getFileInfoByIdentifier($newIdentifier);
1136  $this->assertEquals($newIdentifier, $fileMetadata['identifier']);
1137  }
1138 
1139  public function ‪renamingFiles_dataProvider(): array
1140  {
1141  return [
1142  'file in subfolder' => [
1143  [
1144  'targetFolder' => ['file' => '']
1145  ],
1146  '/targetFolder/file',
1147  'newFile',
1148  '/targetFolder/newFile'
1149  ],
1150  'file in rootfolder' => [
1151  [
1152  'fileInRoot' => ''
1153  ],
1154  '/fileInRoot',
1155  'newFile',
1156  '/newFile'
1157  ]
1158  ];
1159  }
1160 
1169  public function ‪renamingFilesChangesFilenameOnDisk(array $filesystemStructure, string $oldFileIdentifier, string $newFileName, string $expectedNewIdentifier)
1170  {
1171  $this->‪addToMount($filesystemStructure);
1172  $subject = $this->‪createDriver();
1173  $newIdentifier = $subject->renameFile($oldFileIdentifier, $newFileName);
1174  $this->assertFalse($subject->fileExists($oldFileIdentifier));
1175  $this->assertTrue($subject->fileExists($newIdentifier));
1176  $this->assertEquals($expectedNewIdentifier, $newIdentifier);
1177  }
1178 
1182  public function ‪renamingFilesFailsIfTargetFileExists(): void
1183  {
1184  $this->expectException(ExistingTargetFileNameException::class);
1185  $this->expectExceptionCode(1320291063);
1186  $this->‪addToMount([
1187  'targetFolder' => ['file' => '', 'newFile' => '']
1188  ]);
1189  $subject = $this->‪createDriver();
1190  $subject->renameFile('/targetFolder/file', 'newFile');
1191  }
1198  public function ‪renamingFolders_dataProvider(): array
1199  {
1200  return [
1201  'folder in root folder' => [
1202  [
1203  'someFolder' => []
1204  ],
1205  '/someFolder/',
1206  'newFolder',
1207  '/newFolder/'
1208  ],
1209  'file in subfolder' => [
1210  [
1211  'subfolder' => [
1212  'someFolder' => []
1213  ]
1214  ],
1215  '/subfolder/someFolder/',
1216  'newFolder',
1217  '/subfolder/newFolder/'
1218  ]
1219  ];
1220  }
1221 
1231  array $filesystemStructure,
1232  string $oldFolderIdentifier,
1233  string $newFolderName,
1234  string $expectedNewIdentifier
1235  ): void {
1236  $this->‪addToMount($filesystemStructure);
1237  $subject = $this->‪createDriver();
1238  $mapping = $subject->renameFolder($oldFolderIdentifier, $newFolderName);
1239  $this->assertFalse($subject->folderExists($oldFolderIdentifier));
1240  $this->assertTrue($subject->folderExists($expectedNewIdentifier));
1241  $this->assertEquals($expectedNewIdentifier, $mapping[$oldFolderIdentifier]);
1242  }
1243 
1248  {
1249  $fileContents = 'asdfg';
1250  $this->‪addToMount([
1251  'sourceFolder' => [
1252  'subFolder' => ['file' => $fileContents],
1253  'file2' => 'asdfg'
1254  ]
1255  ]);
1256  $subject = $this->‪createDriver();
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/']);
1263  }
1264 
1269  {
1270  $this->expectException(\RuntimeException::class);
1271  $this->expectExceptionCode(1334160746);
1272  $this->‪addToMount([
1273  'sourceFolder' => [
1274  'file' => 'asdfg'
1275  ]
1276  ]);
1277  $subject = $this->‪createDriver([], ['createIdentifierMap']);
1278  $subject->expects($this->atLeastOnce())->method('createIdentifierMap')->will(
1279  $this->throwException(
1280  new ‪FileOperationErrorException('testing', 1476045666)
1281  )
1282  );
1283  $subject->renameFolder('/sourceFolder/', 'newFolder');
1284  $this->assertFileExists($this->‪getUrlInMount('/sourceFolder/file'));
1285  }
1286 
1291  {
1292  // This also prepares the next few tests, so add more info than required for this test
1293  $this->‪addToMount([
1294  'emptyFolder' => []
1295  ]);
1296  $subject = $this->‪createDriver();
1297  $this->assertTrue($subject->isFolderEmpty('/emptyFolder/'));
1298  return $subject;
1299  }
1300 
1304  public function ‪isFolderEmptyReturnsFalseIfFolderHasFile(): void
1305  {
1306  $this->‪addToMount([
1307  'folderWithFile' => [
1308  'someFile' => ''
1309  ]
1310  ]);
1311  $subject = $this->‪createDriver();
1312  $this->assertFalse($subject->isFolderEmpty('/folderWithFile/'));
1313  }
1314 
1318  public function ‪isFolderEmptyReturnsFalseIfFolderHasSubfolder(): void
1319  {
1320  $this->‪addToMount([
1321  'folderWithSubfolder' => [
1322  'someFolder' => []
1323  ]
1324  ]);
1325  $subject = $this->‪createDriver();
1326  $this->assertFalse($subject->isFolderEmpty('/folderWithSubfolder/'));
1327  }
1328 
1329  /**********************************
1330  * Copy/move folder
1331  **********************************/
1335  public function ‪foldersCanBeMovedWithinStorage(): void
1336  {
1337  $fileContents = $this->getUniqueId();
1338  $this->‪addToMount([
1339  'sourceFolder' => [
1340  'file' => $fileContents,
1341  ],
1342  'targetFolder' => [],
1343  ]);
1344  $subject = $this->‪createDriver();
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')));
1349  $this->assertFileNotExists($this->‪getUrlInMount('/sourceFolder'));
1350  }
1351 
1356  {
1357  $fileContents = 'asdfg';
1358  $this->‪addToMount([
1359  'targetFolder' => [],
1360  'sourceFolder' => [
1361  'subFolder' => ['file' => $fileContents],
1362  'file' => 'asdfg'
1363  ]
1364  ]);
1365  $subject = $this->‪createDriver();
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']
1371  );
1372  $this->assertEquals('/targetFolder/sourceFolder/subFolder/', $mappingInformation['/sourceFolder/subFolder/']);
1373  }
1374 
1378  public function ‪folderCanBeRenamedWhenMoving(): void
1379  {
1380  $this->‪addToMount([
1381  'sourceFolder' => [
1382  'file' => $this->getUniqueId(),
1383  ],
1384  'targetFolder' => [],
1385  ]);
1386  $subject = $this->‪createDriver();
1387  $subject->moveFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolder');
1388  $this->assertTrue(file_exists($this->‪getUrlInMount('/targetFolder/newFolder/')));
1389  }
1390 
1395  {
1396  $this->‪addToMount([
1397  'sourceFolder' => [
1398  'file' => $this->getUniqueId(),
1399  ],
1400  'targetFolder' => [],
1401  ]);
1402  $subject = $this->‪createDriver();
1403  $subject->copyFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolderName');
1404  $this->assertTrue(is_file($this->‪getUrlInMount('/targetFolder/newFolderName/file')));
1405  }
1406 
1411  {
1412  [$basePath, $subject] = $this->‪prepareRealTestEnvironment();
1413  GeneralUtility::mkdir_deep($basePath . '/sourceFolder/subFolder');
1414  GeneralUtility::mkdir_deep($basePath . '/targetFolder');
1415 
1416  $subject->copyFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolderName');
1417  $this->assertTrue(is_dir($basePath . '/targetFolder/newFolderName/subFolder'));
1418  }
1419 
1424  {
1425  [$basePath, $subject] = $this->‪prepareRealTestEnvironment();
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');
1430 
1431  $subject->copyFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolderName');
1432  $this->assertTrue(is_file($basePath . '/targetFolder/newFolderName/subFolder/file'));
1433  }
1434 
1436  // Tests concerning sanitizeFileName
1438 
1442  public function ‪setUpCharacterStrings(): void
1443  {
1444  // Generate string containing all characters for the iso8859-1 charset, charcode greater than 127
1445  $this->iso88591GreaterThan127 = '';
1446  for ($i = 0xA0; $i <= 0xFF; $i++) {
1447  $this->iso88591GreaterThan127 .= chr($i);
1448  }
1449 
1450  // Generate string containing all characters for the utf-8 Latin-1 Supplement (U+0080 to U+00FF)
1451  // without U+0080 to U+009F: control characters
1452  // Based on http://www.utf8-chartable.de/unicode-utf8-table.pl
1453  $this->utf8Latin1Supplement = '';
1454  for ($i = 0xA0; $i <= 0xBF; $i++) {
1455  $this->utf8Latin1Supplement .= chr(0xC2) . chr($i);
1456  }
1457  for ($i = 0x80; $i <= 0xBF; $i++) {
1458  $this->utf8Latin1Supplement .= chr(0xC3) . chr($i);
1459  }
1460 
1461  // Generate string containing all characters for the utf-8 Latin-1 Extended-A (U+0100 to U+017F)
1462  $this->utf8Latin1ExtendedA = '';
1463  for ($i = 0x80; $i <= 0xBF; $i++) {
1464  $this->utf8Latin1ExtendedA .= chr(0xC4) . chr($i);
1465  }
1466  for ($i = 0x80; $i <= 0xBF; $i++) {
1467  $this->utf8Latin1ExtendedA .= chr(0xC5) . chr($i);
1468  }
1469  }
1470 
1481  public function ‪sanitizeFileNameUTF8FilesystemDataProvider(): array
1482  {
1483  $this->‪setUpCharacterStrings();
1484  return [
1485  // Characters ordered by ASCII table
1486  'allowed characters utf-8 (ASCII part)' => [
1487  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1488  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
1489  ],
1490  // Characters ordered by ASCII table (except for space-character, because space-character ist trimmed)
1491  'replace special characters with _ (not allowed characters) utf-8 (ASCII part)' => [
1492  '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1493  '_____________________________'
1494  ],
1495  'utf-8 (Latin-1 Supplement)' => [
1497  '________________________________ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'
1498  ],
1499  'trim leading and tailing spaces utf-8' => [
1500  ' test.txt ',
1501  'test.txt'
1502  ],
1503  'remove tailing dot' => [
1504  'test.txt.',
1505  'test.txt'
1506  ],
1507  ];
1508  }
1509 
1516  public function ‪sanitizeFileNameUTF8Filesystem(string $fileName, string $expectedResult): void
1517  {
1518  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'] = 1;
1519  $this->assertEquals(
1520  $expectedResult,
1521  $this->‪createDriver()->sanitizeFileName($fileName)
1522  );
1523  }
1524 
1535  public function ‪sanitizeFileNameNonUTF8FilesystemDataProvider(): array
1536  {
1537  $this->‪setUpCharacterStrings();
1538  return [
1539  // Characters ordered by ASCII table
1540  'allowed characters iso-8859-1' => [
1541  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1542  'iso-8859-1',
1543  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
1544  ],
1545  // Characters ordered by ASCII table
1546  'allowed characters utf-8' => [
1547  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1548  'utf-8',
1549  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
1550  ],
1551  // Characters ordered by ASCII table (except for space-character, because space-character ist trimmed)
1552  'replace special characters with _ (not allowed characters) iso-8859-1' => [
1553  '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1554  'iso-8859-1',
1555  '_____________________________'
1556  ],
1557  // Characters ordered by ASCII table (except for space-character, because space-character ist trimmed)
1558  'replace special characters with _ (not allowed characters) utf-8' => [
1559  '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1560  'utf-8',
1561  '_____________________________'
1562  ],
1563  'iso-8859-1 (code > 127)' => [
1564  // http://de.wikipedia.org/wiki/ISO_8859-1
1565  // chr(0xA0) = NBSP (no-break space) => gets trimmed
1567  'iso-8859-1',
1568  '_centpound_yen____c_a_____R_____-23_u___1o__1_41_23_4_AAAAAEAAAECEEEEIIIIDNOOOOOExOEUUUUEYTHssaaaaaeaaaeceeeeiiiidnoooooe_oeuuuueythy'
1569  ],
1570  'utf-8 (Latin-1 Supplement)' => [
1571  // chr(0xC2) . chr(0x0A) = NBSP (no-break space) => gets trimmed
1573  'utf-8',
1574  '_centpound__yen______c_a_______R_______-23__u_____1o__1_41_23_4_AAAAAEAAAECEEEEIIIIDNOOOOOExOEUUUUEYTHssaaaaaeaaaeceeeeiiiidnoooooe_oeuuuueythy'
1575  ],
1576  'utf-8 (Latin-1 Extended A)' => [
1578  'utf-8',
1579  'AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIJijJjKk__LlLlLlL_l_LlNnNnNn_n____OOooOoOoOEoeRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs'
1580  ],
1581  'trim leading and tailing spaces iso-8859-1' => [
1582  ' test.txt ',
1583  'iso-8859-1',
1584  'test.txt'
1585  ],
1586  'trim leading and tailing spaces utf-8' => [
1587  ' test.txt ',
1588  'utf-8',
1589  'test.txt'
1590  ],
1591  'remove tailing dot iso-8859-1' => [
1592  'test.txt.',
1593  'iso-8859-1',
1594  'test.txt'
1595  ],
1596  'remove tailing dot utf-8' => [
1597  'test.txt.',
1598  'utf-8',
1599  'test.txt'
1600  ],
1601  ];
1602  }
1603 
1611  public function ‪sanitizeFileNameNonUTF8Filesystem(string $fileName, string $charset, string $expectedResult): void
1612  {
1613  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'] = 0;
1614  $this->assertEquals(
1615  $expectedResult,
1616  $this->‪createDriver()->sanitizeFileName($fileName, $charset)
1617  );
1618  }
1619 
1624  {
1625  $this->expectException(InvalidFileNameException::class);
1626  $this->expectExceptionCode(1320288991);
1627 
1628  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'] = 1;
1630  }
1631 
1636  {
1637  $this->expectException(\Exception::class);
1638  $this->expectExceptionCode(1463073434);
1639  $closure = function () {
1640  throw new \Exception('I was called!', 1463073434);
1641  };
1642 
1643  $filterMethods = [
1644  $closure,
1645  ];
1646 
1647  $this->‪createDriver()->_call('applyFilterMethodsToDirectoryItem', $filterMethods, '', '', '');
1648  }
1649 
1654  {
1655  $dummyObject = $this
1656  ->getMockBuilder(LocalDriver::class)
1657  ->setMethods(['dummy'])
1658  ->disableOriginalConstructor()
1659  ->getMock();
1660  $method = [
1661  $dummyObject,
1662  'dummy',
1663  ];
1664  $dummyObject->expects($this->once())->method('dummy');
1665  $filterMethods = [
1666  $method,
1667  ];
1668  $this->‪createDriver()->_call('applyFilterMethodsToDirectoryItem', $filterMethods, '', '', '');
1669  }
1670 }
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\sanitizeFileNameNonUTF8FilesystemDataProvider
‪array sanitizeFileNameNonUTF8FilesystemDataProvider()
Definition: LocalDriverTest.php:1529
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getPublicUrlReturnsValidUrlContainingSpecialCharacters_dataProvider
‪array getPublicUrlReturnsValidUrlContainingSpecialCharacters_dataProvider()
Definition: LocalDriverTest.php:547
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFilesInFolderReturnsEmptyArrayForEmptyDirectory
‪getFilesInFolderReturnsEmptyArrayForEmptyDirectory()
Definition: LocalDriverTest.php:699
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\sanitizeFileNameNonUTF8Filesystem
‪sanitizeFileNameNonUTF8Filesystem(string $fileName, string $charset, string $expectedResult)
Definition: LocalDriverTest.php:1605
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\$iso88591GreaterThan127
‪string $iso88591GreaterThan127
Definition: LocalDriverTest.php:50
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\$utf8Latin1Supplement
‪string $utf8Latin1Supplement
Definition: LocalDriverTest.php:54
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\sanitizeFileNameUTF8FilesystemDataProvider
‪array sanitizeFileNameUTF8FilesystemDataProvider()
Definition: LocalDriverTest.php:1475
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getSpecificFileInformationDataProvider
‪array getSpecificFileInformationDataProvider()
Definition: LocalDriverTest.php:321
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getPublicUrlReturnsValidUrlContainingSpecialCharacters
‪getPublicUrlReturnsValidUrlContainingSpecialCharacters(string $fileIdentifier)
Definition: LocalDriverTest.php:562
‪TYPO3\CMS\Core\Core\Environment\getPublicPath
‪static string getPublicPath()
Definition: Environment.php:153
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\$testDirs
‪array $testDirs
Definition: LocalDriverTest.php:46
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\filesCanBeCopiedWithinStorage
‪filesCanBeCopiedWithinStorage()
Definition: LocalDriverTest.php:1081
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\fileContentsCanBeWrittenAndRead
‪fileContentsCanBeWrittenAndRead()
Definition: LocalDriverTest.php:578
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\permissionsAreCorrectlyRetrievedForAllowedFile
‪permissionsAreCorrectlyRetrievedForAllowedFile()
Definition: LocalDriverTest.php:991
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFolderInFolderReturnsCorrectFolderObject
‪getFolderInFolderReturnsCorrectFolderObject()
Definition: LocalDriverTest.php:234
‪TYPO3\CMS\Core\Resource\Driver\LocalDriver
Definition: LocalDriver.php:33
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFileInFolderCallsConfiguredCallbackFunctionWithGivenItemName
‪getFileInFolderCallsConfiguredCallbackFunctionWithGivenItemName()
Definition: LocalDriverTest.php:766
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesFileInSingleSubFolderToNewFolderName
‪copyFolderWithinStorageCopiesFileInSingleSubFolderToNewFolderName()
Definition: LocalDriverTest.php:1417
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesSingleFileToNewFolderName
‪copyFolderWithinStorageCopiesSingleFileToNewFolderName()
Definition: LocalDriverTest.php:1388
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\filesCanBeCopiedToATemporaryPath
‪filesCanBeCopiedToATemporaryPath()
Definition: LocalDriverTest.php:973
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\isFolderEmptyReturnsFalseIfFolderHasFile
‪isFolderEmptyReturnsFalseIfFolderHasFile()
Definition: LocalDriverTest.php:1298
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getPublicUrlReturnsCorrectUriForConfiguredBaseUri
‪getPublicUrlReturnsCorrectUriForConfiguredBaseUri()
Definition: LocalDriverTest.php:526
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getDefaultFolderReturnsFolderForUserUploadPath
‪getDefaultFolderReturnsFolderForUserUploadPath()
Definition: LocalDriverTest.php:215
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\fileMetadataIsChangedAfterMovingFile
‪fileMetadataIsChangedAfterMovingFile()
Definition: LocalDriverTest.php:1116
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFileListReturnsAllFilesInSubdirectoryIfRecursiveParameterIsSet
‪getFileListReturnsAllFilesInSubdirectoryIfRecursiveParameterIsSet()
Definition: LocalDriverTest.php:729
‪TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
Definition: BaseTestCase.php:24
‪TYPO3\CMS\Core\Core\Environment\isWindows
‪static bool isWindows()
Definition: Environment.php:266
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\isFolderEmptyReturnsFalseIfFolderHasSubfolder
‪isFolderEmptyReturnsFalseIfFolderHasSubfolder()
Definition: LocalDriverTest.php:1312
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\renamingFolders_dataProvider
‪array renamingFolders_dataProvider()
Definition: LocalDriverTest.php:1192
‪TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException
Definition: ExistingTargetFileNameException.php:21
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\addFileReturnsFileIdentifier
‪addFileReturnsFileIdentifier()
Definition: LocalDriverTest.php:470
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\renamingFilesFailsIfTargetFileExists
‪renamingFilesFailsIfTargetFileExists()
Definition: LocalDriverTest.php:1176
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\isFolderEmptyReturnsTrueForEmptyFolder
‪isFolderEmptyReturnsTrueForEmptyFolder()
Definition: LocalDriverTest.php:1284
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\setUpCharacterStrings
‪setUpCharacterStrings()
Definition: LocalDriverTest.php:1436
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\isWithinAcceptsFileAndFolderObjectsAsContent
‪isWithinAcceptsFileAndFolderObjectsAsContent()
Definition: LocalDriverTest.php:1067
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\determineBaseUrlUrlEncodesUriParts
‪determineBaseUrlUrlEncodesUriParts()
Definition: LocalDriverTest.php:190
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\createFolderSanitizesFolderNameBeforeCreation
‪createFolderSanitizesFolderNameBeforeCreation(string $newFolderName, string $expectedFolderName)
Definition: LocalDriverTest.php:292
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\newFilesCanBeCreated
‪newFilesCanBeCreated()
Definition: LocalDriverTest.php:614
‪$dir
‪$dir
Definition: validateRstFiles.php:213
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\createRealTestdir
‪string createRealTestdir()
Definition: LocalDriverTest.php:80
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\createFolderCreatesFolderOnDisk
‪createFolderCreatesFolderOnDisk()
Definition: LocalDriverTest.php:249
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\addFileFailsIfFileIsInDriverStorage
‪addFileFailsIfFileIsInDriverStorage()
Definition: LocalDriverTest.php:454
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\$resetSingletonInstances
‪bool $resetSingletonInstances
Definition: LocalDriverTest.php:38
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFolderListFailsIfDirectoryDoesNotExist
‪getFolderListFailsIfDirectoryDoesNotExist()
Definition: LocalDriverTest.php:903
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\foldersCanBeMovedWithinStorage
‪foldersCanBeMovedWithinStorage()
Definition: LocalDriverTest.php:1329
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\applyFilterMethodsToDirectoryItemCallsFilterMethodIfClosure
‪applyFilterMethodsToDirectoryItemCallsFilterMethodIfClosure()
Definition: LocalDriverTest.php:1629
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\hashReturnsCorrectHashes
‪hashReturnsCorrectHashes()
Definition: LocalDriverTest.php:915
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver
Definition: AbstractDriverTest.php:2
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\applyFilterMethodsToDirectoryItemCallsFilterMethodIfName
‪applyFilterMethodsToDirectoryItemCallsFilterMethodIfName()
Definition: LocalDriverTest.php:1647
‪TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase\addToVfs
‪addToVfs(array $dirStructure)
Definition: BaseTestCase.php:84
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\calculatedBasePathAbsoluteIsSane
‪calculatedBasePathAbsoluteIsSane()
Definition: LocalDriverTest.php:158
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFileForLocalProcessingCreatesCopyOfFileByDefault
‪getFileForLocalProcessingCreatesCopyOfFileByDefault()
Definition: LocalDriverTest.php:941
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\hashingWithUnsupportedAlgorithmFails
‪hashingWithUnsupportedAlgorithmFails()
Definition: LocalDriverTest.php:929
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\createdFilesAreEmpty
‪createdFilesAreEmpty()
Definition: LocalDriverTest.php:625
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\renameFolderReturnsCorrectMappingInformationForAllFiles
‪renameFolderReturnsCorrectMappingInformationForAllFiles()
Definition: LocalDriverTest.php:1241
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getAbsolutePathReturnsCorrectPath
‪getAbsolutePathReturnsCorrectPath()
Definition: LocalDriverTest.php:398
‪TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase\$basedir
‪string $basedir
Definition: BaseTestCase.php:27
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\createFileFixesPermissionsOnCreatedFile
‪createFileFixesPermissionsOnCreatedFile()
Definition: LocalDriverTest.php:637
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFileThrowsExceptionIfFileDoesNotExist
‪getFileThrowsExceptionIfFileDoesNotExist()
Definition: LocalDriverTest.php:688
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\callbackStaticTestFunction
‪static callbackStaticTestFunction(string $itemName)
Definition: LocalDriverTest.php:795
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\folderCanBeRenamedWhenMoving
‪folderCanBeRenamedWhenMoving()
Definition: LocalDriverTest.php:1372
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\defaultLevelFolderFolderIsCreatedIfItDoesntExist
‪defaultLevelFolderFolderIsCreatedIfItDoesntExist()
Definition: LocalDriverTest.php:225
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\existenceChecksInFolderWorkForFilesAndFolders
‪existenceChecksInFolderWorkForFilesAndFolders()
Definition: LocalDriverTest.php:508
‪TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase\getMountRootUrl
‪getMountRootUrl()
Definition: BaseTestCase.php:43
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\sanitizeFileNameThrowsExceptionOnInvalidFileName
‪sanitizeFileNameThrowsExceptionOnInvalidFileName()
Definition: LocalDriverTest.php:1617
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\$localDriver
‪LocalDriver $localDriver
Definition: LocalDriverTest.php:42
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\existenceChecksWorkForFilesAndFolders
‪existenceChecksWorkForFilesAndFolders()
Definition: LocalDriverTest.php:491
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\permissionsAreCorrectlyRetrievedForAllowedFolder
‪permissionsAreCorrectlyRetrievedForAllowedFolder()
Definition: LocalDriverTest.php:1022
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\permissionsAreCorrectlyRetrievedForForbiddenFile
‪permissionsAreCorrectlyRetrievedForForbiddenFile()
Definition: LocalDriverTest.php:1004
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\setFileContentsReturnsNumberOfBytesWrittenToFile
‪setFileContentsReturnsNumberOfBytesWrittenToFile()
Definition: LocalDriverTest.php:598
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFileForLocalProcessingReturnsOriginalFilepathForReadonlyAccess
‪getFileForLocalProcessingReturnsOriginalFilepathForReadonlyAccess()
Definition: LocalDriverTest.php:957
‪TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase\getUrlInMount
‪string getUrlInMount($path)
Definition: BaseTestCase.php:74
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\$utf8Latin1ExtendedA
‪string $utf8Latin1ExtendedA
Definition: LocalDriverTest.php:58
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\prepareRealTestEnvironment
‪array prepareRealTestEnvironment()
Definition: LocalDriverTest.php:94
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\addFileUsesFilenameIfGiven
‪addFileUsesFilenameIfGiven()
Definition: LocalDriverTest.php:434
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\createFolderSanitizesFolderNameBeforeCreationDataProvider
‪static array createFolderSanitizesFolderNameBeforeCreationDataProvider()
Definition: LocalDriverTest.php:272
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesSingleSubFolderToNewFolderName
‪copyFolderWithinStorageCopiesSingleSubFolderToNewFolderName()
Definition: LocalDriverTest.php:1404
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFolderListReturnsAllDirectoriesInDirectory
‪getFolderListReturnsAllDirectoriesInDirectory()
Definition: LocalDriverTest.php:830
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\isWithinRecognizesFilesWithinFolderAndInOtherFolders
‪isWithinRecognizesFilesWithinFolderAndInOtherFolders()
Definition: LocalDriverTest.php:1056
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\permissionsAreCorrectlyRetrievedForForbiddenFolder
‪permissionsAreCorrectlyRetrievedForForbiddenFolder()
Definition: LocalDriverTest.php:1035
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\addFileMovesFileToCorrectLocation
‪addFileMovesFileToCorrectLocation()
Definition: LocalDriverTest.php:414
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\calculatedBasePathRelativeIsSane
‪calculatedBasePathRelativeIsSane()
Definition: LocalDriverTest.php:141
‪TYPO3\CMS\Core\Resource\ResourceStorage
Definition: ResourceStorage.php:74
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\renamingFoldersChangesFolderNameOnDisk
‪renamingFoldersChangesFolderNameOnDisk(array $filesystemStructure, string $oldFolderIdentifier, string $newFolderName, string $expectedNewIdentifier)
Definition: LocalDriverTest.php:1224
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFileListReturnsAllFilesInDirectory
‪getFileListReturnsAllFilesInDirectory()
Definition: LocalDriverTest.php:709
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFolderListFiltersItemsWithGivenFilterMethods
‪getFolderListFiltersItemsWithGivenFilterMethods()
Definition: LocalDriverTest.php:882
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\noSecondSlashIsAddedIfBasePathAlreadyHasTrailingSlash
‪noSecondSlashIsAddedIfBasePathAlreadyHasTrailingSlash()
Definition: LocalDriverTest.php:312
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\basePathIsNormalizedWithTrailingSlash
‪basePathIsNormalizedWithTrailingSlash()
Definition: LocalDriverTest.php:303
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\createDriver
‪LocalDriver createDriver(array $driverConfiguration=[], array $mockedDriverMethods=[])
Definition: LocalDriverTest.php:112
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFileReturnsCorrectIdentifier
‪getFileReturnsCorrectIdentifier()
Definition: LocalDriverTest.php:665
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFileListFailsIfDirectoryDoesNotExist
‪getFileListFailsIfDirectoryDoesNotExist()
Definition: LocalDriverTest.php:754
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:39
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest
Definition: LocalDriverTest.php:35
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\filesCanBeMovedWithinStorage
‪filesCanBeMovedWithinStorage()
Definition: LocalDriverTest.php:1099
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\tearDown
‪tearDown()
Definition: LocalDriverTest.php:63
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\renamingFiles_dataProvider
‪renamingFiles_dataProvider()
Definition: LocalDriverTest.php:1133
‪TYPO3\CMS\Core\Resource\ResourceStorageInterface\CAPABILITY_PUBLIC
‪const CAPABILITY_PUBLIC
Definition: ResourceStorageInterface.php:58
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\createFolderRecursiveSanitizesFilename
‪createFolderRecursiveSanitizesFilename()
Definition: LocalDriverTest.php:174
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\sanitizeFileNameUTF8Filesystem
‪sanitizeFileNameUTF8Filesystem(string $fileName, string $expectedResult)
Definition: LocalDriverTest.php:1510
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\moveFolderWithinStorageReturnsCorrectMappingInformationForAllFiles
‪moveFolderWithinStorageReturnsCorrectMappingInformationForAllFiles()
Definition: LocalDriverTest.php:1349
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\Fixtures\LocalDriverFilenameFilter
Definition: LocalDriverFilenameFilter.php:21
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase\getUrl
‪string getUrl($path)
Definition: BaseTestCase.php:95
‪TYPO3\CMS\Core\Resource\Exception\FileOperationErrorException
Definition: FileOperationErrorException.php:21
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFileListFiltersItemsWithGivenFilterMethods
‪getFileListFiltersItemsWithGivenFilterMethods()
Definition: LocalDriverTest.php:805
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFolderListLeavesOutNavigationalEntries
‪getFolderListLeavesOutNavigationalEntries()
Definition: LocalDriverTest.php:866
‪TYPO3\CMS\Core\Resource\Driver\LocalDriver\sanitizeFileName
‪string sanitizeFileName($fileName, $charset='utf-8')
Definition: LocalDriver.php:306
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\renamingFilesChangesFilenameOnDisk
‪renamingFilesChangesFilenameOnDisk(array $filesystemStructure, string $oldFileIdentifier, string $newFileName, string $expectedNewIdentifier)
Definition: LocalDriverTest.php:1163
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\createFolderReturnsFolderObject
‪createFolderReturnsFolderObject()
Definition: LocalDriverTest.php:261
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getFolderListReturnsHiddenFoldersByDefault
‪getFolderListReturnsHiddenFoldersByDefault()
Definition: LocalDriverTest.php:846
‪TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException
Definition: InvalidFileNameException.php:21
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getSpecificFileInformationReturnsRequestedFileInformation
‪getSpecificFileInformationReturnsRequestedFileInformation($expectedValue, string $property)
Definition: LocalDriverTest.php:373
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\renameFolderRevertsRenamingIfFilenameMapCannotBeCreated
‪renameFolderRevertsRenamingIfFilenameMapCannotBeCreated()
Definition: LocalDriverTest.php:1262
‪TYPO3\CMS\Core\Core\Environment\getVarPath
‪static string getVarPath()
Definition: Environment.php:165
‪TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase\addToMount
‪addToMount(array $dirStructure)
Definition: BaseTestCase.php:63
‪TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase\initializeVfs
‪initializeVfs()
Definition: BaseTestCase.php:53