‪TYPO3CMS  ‪main
LocalDriverTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
29 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
30 
31 class ‪LocalDriverTest extends FunctionalTestCase
32 {
33  protected bool ‪$initializeDatabase = false;
34 
35  private string ‪$baseDirectory;
36 
37  protected function ‪setUp(): void
38  {
39  parent::setUp();
40  $this->baseDirectory = $this->instancePath . '/local-driver-tests';
41  mkdir($this->baseDirectory);
42  mkdir(‪Environment::getVarPath() . '/tests');
43  }
44 
45  protected function ‪tearDown(): void
46  {
47  ‪GeneralUtility::rmdir($this->instancePath . '/local-driver-tests', true);
49  parent::tearDown();
50  }
51 
53  {
54  $driverConfiguration = [
55  'basePath' => ‪$this->baseDirectory,
56  ];
57  $subject = new ‪LocalDriver($driverConfiguration);
58  $subject->processConfiguration();
59  return $subject;
60  }
61 
65  public function ‪calculatedBasePathRelativeIsSane(): void
66  {
67  // 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
68  $relativeDriverConfiguration = [
69  'pathType' => 'relative',
70  'basePath' => '/typo3temp/var/tests/',
71  ];
72  $subject = $this->getAccessibleMock(LocalDriver::class, null);
73  $basePath = $subject->_call('calculateBasePath', $relativeDriverConfiguration);
74  self::assertStringNotContainsString('//', $basePath);
75  }
76 
80  public function ‪calculatedBasePathAbsoluteIsSane(): void
81  {
82  // This test checks if "/../" are properly filtered out (i.e. from "Base path" field of sys_file_storage)
83  $varPath = ‪Environment::getVarPath();
84  $projectPath = ‪Environment::getProjectPath();
85  $relativeVarPath = str_replace($projectPath, '', $varPath);
86  $segments = str_repeat('/..', substr_count($relativeVarPath, '/') + 1);
87  $relativeDriverConfiguration = [
88  'basePath' => ‪Environment::getVarPath() . '/tests' . $segments . $relativeVarPath . '/tests/',
89  ];
90  $subject = $this->getAccessibleMock(LocalDriver::class, null);
91  $basePath = $subject->_call('calculateBasePath', $relativeDriverConfiguration);
92  self::assertStringNotContainsString('/../', $basePath);
93  }
94 
96  {
97  return [
98  'no base uri, within public' => [
99  '/files/',
100  '',
101  '/foo.txt',
102  true,
103  'files/foo.txt',
104  ],
105  'no base uri, within project' => [
106  '/../files/',
107  '',
108  '/foo.txt',
109  false,
110  null,
111  ],
112  'base uri with host, within public' => [
113  '/files/',
114  'https://host.tld/',
115  '/foo.txt',
116  true,
117  'https://host.tld/foo.txt',
118  ],
119  'base uri with host, within project' => [
120  '/../files/',
121  'https://host.tld/',
122  '/foo.txt',
123  true,
124  'https://host.tld/foo.txt',
125  ],
126  'base uri with path only, within public' => [
127  '/files/',
128  'assets/',
129  '/foo.txt',
130  true,
131  'assets/foo.txt',
132  ],
133  'base uri with path only, within project' => [
134  '/../files/',
135  'assets/',
136  '/foo.txt',
137  true,
138  'assets/foo.txt',
139  ],
140  'base uri with path only, within other public dir' => [
141  '/../public/assets/',
142  'assets/',
143  '/foo.txt',
144  true,
145  'assets/foo.txt',
146  ],
147  ];
148  }
149 
154  public function ‪publicUrlIsCalculatedCorrectlyWithDifferentBasePathsAndBasUris(string $basePath, string $baseUri, string $fileName, bool $expectedIsPublic, ?string $expectedPublicUrl): void
155  {
156  $projectPath = $this->baseDirectory . '/app';
157  $publicPath = $projectPath . '/public';
158  $absoluteBaseDir = $publicPath . $basePath;
159  mkdir($projectPath);
160  mkdir($publicPath);
161  mkdir($absoluteBaseDir, 0777, true);
164  true,
165  false,
166  $projectPath,
167  $publicPath,
171  ‪Environment::isUnix() ? 'UNIX' : 'WINDOWS'
172  );
173  $driverConfiguration = [
174  'pathType' => 'relative',
175  'basePath' => $basePath,
176  'baseUri' => $baseUri,
177  ];
178  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
179  $subject->processConfiguration();
180  self::assertSame($expectedIsPublic, $subject->hasCapability(‪ResourceStorageInterface::CAPABILITY_PUBLIC));
181  self::assertSame($fileName, $subject->createFile($fileName, '/'));
182  self::assertSame($expectedPublicUrl, $subject->getPublicUrl($fileName));
183  }
184 
189  {
190  $driverConfiguration = [
191  'basePath' => ‪$this->baseDirectory,
192  ];
193  $subject = $this->getAccessibleMock(LocalDriver::class, ['sanitizeFilename'], [$driverConfiguration]);
194  $subject->processConfiguration();
195  $subject->expects(self::exactly(2))
196  ->method('sanitizeFileName')
197  ->willReturn(
198  'sanitized'
199  );
200  $subject->createFolder('newFolder/andSubfolder', '/', true);
201  self::assertFileExists($this->baseDirectory . '/sanitized/sanitized');
202  }
203 
208  {
209  $subject = $this->getAccessibleMock(LocalDriver::class, ['hasCapability'], [], '', false);
210  $subject->expects(self::once())
211  ->method('hasCapability')
213  ->willReturn(
214  true
215  );
216  $subject->_set('absoluteBasePath', ‪Environment::getPublicPath() . '/un encö/ded %path/');
217  $subject->_call('determineBaseUrl');
218  $baseUri = $subject->_get('baseUri');
219  self::assertEquals(rawurlencode('un encö') . '/' . rawurlencode('ded %path') . '/', $baseUri);
220  }
221 
226  {
227  $subject = $this->‪getDefaultInitializedSubject();
228  self::assertEquals('/user_upload/', $subject->getDefaultFolder());
229  }
230 
235  {
236  $subject = $this->‪getDefaultInitializedSubject();
237  self::assertFileExists($this->baseDirectory . '/' . $subject->getDefaultFolder());
238  }
239 
244  {
245  mkdir($this->baseDirectory . '/someDir');
246  mkdir($this->baseDirectory . '/someDir/someSubdir');
247  $subject = $this->‪getDefaultInitializedSubject();
248  self::assertEquals('/someDir/someSubdir/', $subject->getFolderInFolder('someSubdir', '/someDir/'));
249  }
250 
254  public function ‪createFolderCreatesFolderOnDisk(): void
255  {
256  mkdir($this->baseDirectory . '/some');
257  mkdir($this->baseDirectory . '/some/folder');
258  $subject = $this->‪getDefaultInitializedSubject();
259  $subject->createFolder('path', '/some/folder/');
260  self::assertFileExists($this->baseDirectory . '/some/folder/path');
261  }
262 
266  public function ‪createFolderReturnsFolderObject(): void
267  {
268  mkdir($this->baseDirectory . '/some');
269  mkdir($this->baseDirectory . '/some/folder');
270  $subject = $this->‪getDefaultInitializedSubject();
271  $createdFolder = $subject->createFolder('path', '/some/folder/');
272  self::assertEquals('/some/folder/path/', $createdFolder);
273  }
274 
276  {
277  return [
278  'folder name with NULL character' => [
279  'some' . "\0" . 'Folder',
280  'some_Folder',
281  ],
282  'folder name with directory part' => [
283  '../someFolder',
284  '.._someFolder',
285  ],
286  ];
287  }
288 
293  public function ‪createFolderSanitizesFolderNameBeforeCreation(string $newFolderName, string $expectedFolderName): void
294  {
295  mkdir($this->baseDirectory . '/some');
296  mkdir($this->baseDirectory . '/some/folder');
297  $subject = $this->‪getDefaultInitializedSubject();
298  $subject->createFolder($newFolderName, '/some/folder/');
299  self::assertFileExists($this->baseDirectory . '/some/folder/' . $expectedFolderName);
300  }
301 
306  {
307  $driverConfiguration = [
308  'basePath' => ‪$this->baseDirectory,
309  ];
310  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
311  $subject->processConfiguration();
312  self::assertEquals('/', substr($subject->_call('getAbsoluteBasePath'), -1));
313  }
314 
319  {
320  $driverConfiguration = [
321  'basePath' => ‪$this->baseDirectory,
322  ];
323  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
324  $subject->processConfiguration();
325  self::assertNotEquals('/', substr($subject->_call('getAbsoluteBasePath'), -2, 1));
326  }
327 
328  public static function ‪getSpecificFileInformationDataProvider(): array
329  {
330  return [
331  'size' => [
332  'expectedValue' => filesize(__DIR__ . '/Fixtures/Dummy.html'),
333  'propertyName' => 'size',
334  ],
335  'atime' => [
336  'expectedValue' => 'WILL_BE_REPLACED_BY_VFS_TIME',
337  'propertyName' => 'atime',
338  ],
339  'mtime' => [
340  'expectedValue' => 'WILL_BE_REPLACED_BY_VFS_TIME',
341  'propertyName' => 'mtime',
342  ],
343  'ctime' => [
344  'expectedValue' => 'WILL_BE_REPLACED_BY_VFS_TIME',
345  'propertyName' => 'ctime',
346  ],
347  'name' => [
348  'expectedValue' => 'Dummy.html',
349  'propertyName' => 'name',
350  ],
351  'mimetype' => [
352  'expectedValue' => 'text/html',
353  'propertyName' => 'mimetype',
354  ],
355  'identifier' => [
356  'expectedValue' => '/Dummy.html',
357  'propertyName' => 'identifier',
358  ],
359  'storage' => [
360  'expectedValue' => 5,
361  'propertyName' => 'storage',
362  ],
363  'identifier_hash' => [
364  'expectedValue' => 'b11efa5d7c0556a65c6aa261343b9807cac993bc',
365  'propertyName' => 'identifier_hash',
366  ],
367  'folder_hash' => [
368  'expectedValue' => '42099b4af021e53fd8fd4e056c2568d7c2e3ffa8',
369  'propertyName' => 'folder_hash',
370  ],
371  ];
372  }
373 
378  public function ‪getSpecificFileInformationReturnsRequestedFileInformation(string|int $expectedValue, string $property): void
379  {
380  copy(__DIR__ . '/Fixtures/Dummy.html', $this->baseDirectory . '/Dummy.html');
381  if (in_array($property, ['mtime', 'ctime', 'atime'])) {
382  $expectedValue = filemtime($this->baseDirectory . '/Dummy.html');
383  }
384  $subject = $this->‪getDefaultInitializedSubject();
385  $subject->setStorageUid(5);
386  self::assertSame($expectedValue, $subject->getSpecificFileInformation($this->baseDirectory . '/Dummy.html', '/', $property));
387  }
388 
392  public function ‪getAbsolutePathReturnsCorrectPath(): void
393  {
394  mkdir($this->baseDirectory . '/someFolder');
395  file_put_contents($this->baseDirectory . '/someFolder/file1.ext', 'asdfg');
396  $driverConfiguration = [
397  'basePath' => ‪$this->baseDirectory,
398  ];
399  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
400  $subject->processConfiguration();
401  self::assertEquals($this->baseDirectory . '/someFolder/file1.ext', $subject->_call('getAbsolutePath', '/someFolder/file1.ext'));
402  }
403 
407  public function ‪addFileMovesFileToCorrectLocation(): void
408  {
409  mkdir($this->baseDirectory . '/targetFolder');
410  mkdir($this->baseDirectory . '/sourceFolder');
411  file_put_contents($this->baseDirectory . '/sourceFolder/file', 'asdf');
412  $subject = $this->‪getDefaultInitializedSubject();
413  $subject->addFile($this->baseDirectory . '/sourceFolder/file', '/targetFolder/', 'file');
414  self::assertFileExists($this->baseDirectory . '/targetFolder/file');
415  }
416 
420  public function ‪addFileUsesFilenameIfGiven(): void
421  {
422  mkdir($this->baseDirectory . '/targetFolder');
423  mkdir($this->baseDirectory . '/sourceFolder');
424  file_put_contents($this->baseDirectory . '/sourceFolder/file', 'asdf');
425  $subject = $this->‪getDefaultInitializedSubject();
426  $subject->addFile($this->baseDirectory . '/sourceFolder/file', '/targetFolder/', 'targetFile');
427  self::assertFileExists($this->baseDirectory . '/targetFolder/targetFile');
428  }
429 
434  {
435  $this->expectException(\InvalidArgumentException::class);
436  $this->expectExceptionCode(1314778269);
437  mkdir($this->baseDirectory . '/targetFolder');
438  file_put_contents($this->baseDirectory . '/targetFolder/file', 'asdf');
439  $subject = $this->‪getDefaultInitializedSubject();
440  $subject->setStorageUid(5);
441  $subject->addFile($this->baseDirectory . '/targetFolder/file', '/targetFolder/', 'file');
442  }
443 
447  public function ‪addFileReturnsFileIdentifier(): void
448  {
449  mkdir($this->baseDirectory . '/targetFolder');
450  mkdir($this->baseDirectory . '/sourceFolder');
451  file_put_contents($this->baseDirectory . '/sourceFolder/file', 'asdf');
452  $subject = $this->‪getDefaultInitializedSubject();
453  $fileIdentifier = $subject->addFile($this->baseDirectory . '/sourceFolder/file', '/targetFolder/', 'file');
454  self::assertEquals('/targetFolder/file', $fileIdentifier);
455  }
456 
461  {
462  mkdir($this->baseDirectory . '/folder');
463  file_put_contents($this->baseDirectory . '/file', 'asdf');
464  $subject = $this->‪getDefaultInitializedSubject();
465  self::assertTrue($subject->fileExists('/file'));
466  self::assertTrue($subject->folderExists('/folder/'));
467  self::assertFalse($subject->fileExists('/nonexistingFile'));
468  self::assertFalse($subject->folderExists('/nonexistingFolder/'));
469  }
470 
475  {
476  mkdir($this->baseDirectory . '/subfolder');
477  file_put_contents($this->baseDirectory . '/subfolder/file', 'asdf');
478  mkdir($this->baseDirectory . '/subfolder/folder');
479  $subject = $this->‪getDefaultInitializedSubject();
480  self::assertTrue($subject->fileExistsInFolder('file', '/subfolder/'));
481  self::assertTrue($subject->folderExistsInFolder('folder', '/subfolder/'));
482  self::assertFalse($subject->fileExistsInFolder('nonexistingFile', '/subfolder/'));
483  self::assertFalse($subject->folderExistsInFolder('nonexistingFolder', '/subfolder/'));
484  }
485 
490  {
491  $baseUri = 'https://example.org/foobar/' . ‪StringUtility::getUniqueId('uri_');
492  $driverConfiguration = [
493  'baseUri' => $baseUri,
494  'basePath' => ‪$this->baseDirectory,
495  ];
496  $subject = new ‪LocalDriver($driverConfiguration);
497  $subject->processConfiguration();
498  self::assertEquals($baseUri . '/file.ext', $subject->getPublicUrl('/file.ext'));
499  self::assertEquals($baseUri . '/subfolder/file2.ext', $subject->getPublicUrl('/subfolder/file2.ext'));
500  }
501 
503  {
504  return [
505  ['/single file with some special chars äüö!.txt'],
506  ['/on subfolder/with special chars äüö!.ext'],
507  ['/who names a file like !"§$%&()=?*+~"#\'´`<>-.ext'],
508  ['no leading slash !"§$%&()=?*+~#\'"´`"<>-.txt'],
509  ];
510  }
511 
516  public function ‪getPublicUrlReturnsValidUrlContainingSpecialCharacters(string $fileIdentifier): void
517  {
518  $baseUri = 'https://example.org/foobar/' . ‪StringUtility::getUniqueId('uri_');
519  $driverConfiguration = [
520  'baseUri' => $baseUri,
521  'basePath' => ‪$this->baseDirectory,
522  ];
523  $subject = new ‪LocalDriver($driverConfiguration);
524  $subject->processConfiguration();
525  ‪$publicUrl = $subject->getPublicUrl($fileIdentifier);
526  self::assertTrue(‪GeneralUtility::isValidUrl(‪$publicUrl));
527  }
528 
532  public function ‪fileContentsCanBeWrittenAndRead(): void
533  {
534  $fileContents = 'asdf';
535  file_put_contents($this->baseDirectory . '/file.ext', $fileContents);
536  $subject = $this->‪getDefaultInitializedSubject();
537  self::assertEquals($fileContents, $subject->getFileContents('/file.ext'));
538  $newFileContents = 'asdfgh';
539  $subject->setFileContents('/file.ext', $newFileContents);
540  self::assertEquals($newFileContents, $subject->getFileContents('/file.ext'));
541  }
542 
547  {
548  $fileContents = 'asdf';
549  file_put_contents($this->baseDirectory . '/file.ext', $fileContents);
550  $subject = $this->‪getDefaultInitializedSubject();
551  $newFileContents = 'asdfgh';
552  $bytesWritten = $subject->setFileContents('/file.ext', $newFileContents);
553  self::assertEquals(strlen($newFileContents), $bytesWritten);
554  }
555 
559  public function ‪newFilesCanBeCreated(): void
560  {
561  $subject = $this->‪getDefaultInitializedSubject();
562  $subject->createFile('testfile.txt', '/');
563  self::assertFileExists($this->baseDirectory . '/testfile.txt');
564  self::assertTrue($subject->fileExists('/testfile.txt'));
565  }
566 
570  public function ‪createdFilesAreEmpty(): void
571  {
572  $subject = $this->‪getDefaultInitializedSubject();
573  $subject->createFile('testfile.txt', '/');
574  self::assertSame('', file_get_contents($this->baseDirectory . '/testfile.txt'));
575  $fileData = $subject->getFileContents('/testfile.txt');
576  self::assertEquals(0, strlen($fileData));
577  }
578 
583  {
585  self::markTestSkipped('createdFilesHaveCorrectRights() tests not available on Windows');
586  }
587  // No one will use this as his default file create mask, we hopefully don't get any false positives
588  $testPattern = '0646';
589  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = $testPattern;
590  mkdir($this->baseDirectory . '/someDir');
591  $subject = $this->‪getDefaultInitializedSubject();
592  $subject->createFile('testfile.txt', '/someDir');
593  self::assertEquals((int)$testPattern, (int)(decoct(fileperms($this->baseDirectory . '/someDir/testfile.txt') & 0777)));
594  }
595 
599  public function ‪getFileReturnsCorrectIdentifier(): void
600  {
601  copy(__DIR__ . '/Fixtures/Dummy.html', $this->baseDirectory . '/Dummy.html');
602  copy(__DIR__ . '/Fixtures/LocalDriverFilenameFilter.php', $this->baseDirectory . '/LocalDriverFilenameFilter.php');
603  $subject = $this->‪getDefaultInitializedSubject();
604  $fileInfo = $subject->getFileInfoByIdentifier('Dummy.html');
605  self::assertEquals('/Dummy.html', $fileInfo['identifier']);
606  $fileInfo = $subject->getFileInfoByIdentifier('LocalDriverFilenameFilter.php');
607  self::assertEquals('/LocalDriverFilenameFilter.php', $fileInfo['identifier']);
608  }
609 
614  {
615  $this->expectException(\InvalidArgumentException::class);
616  $this->expectExceptionCode(1314516809);
617  $subject = $this->‪getDefaultInitializedSubject();
618  $subject->getFileInfoByIdentifier('/some/file/at/a/random/path');
619  }
620 
625  {
626  $subject = $this->‪getDefaultInitializedSubject();
627  $fileList = $subject->getFilesInFolder('/');
628  self::assertEmpty($fileList);
629  }
630 
635  {
636  mkdir($this->baseDirectory . '/aDir');
637  file_put_contents($this->baseDirectory . '/file1', 'asdfg');
638  file_put_contents($this->baseDirectory . '/file2', 'fdsa');
639  $subject = $this->‪getDefaultInitializedSubject();
640  $fileList = $subject->getFilesInFolder('/');
641  self::assertEquals(['/file1', '/file2'], array_keys($fileList));
642  }
643 
648  {
649  mkdir($this->baseDirectory . '/aDir');
650  file_put_contents($this->baseDirectory . '/aDir/file3', 'asdfgh');
651  mkdir($this->baseDirectory . '/aDir/subDir');
652  file_put_contents($this->baseDirectory . '/aDir/subDir/file4', 'asklfjklasjkl');
653  file_put_contents($this->baseDirectory . '/file1', 'asdfg');
654  file_put_contents($this->baseDirectory . '/file2', 'fdsa');
655  $subject = $this->‪getDefaultInitializedSubject();
656  $fileList = $subject->getFilesInFolder('/', 0, 0, true);
657  self::assertEquals(['/file1', '/file2', '/aDir/file3', '/aDir/subDir/file4'], array_keys($fileList));
658  }
659 
664  {
665  $this->expectException(\InvalidArgumentException::class);
666  $this->expectExceptionCode(1314349666);
667  file_put_contents($this->baseDirectory . '/somefile', '');
668  $subject = $this->‪getDefaultInitializedSubject();
669  $subject->getFilesInFolder('somedir/');
670  }
671 
676  {
677  file_put_contents($this->baseDirectory . '/file2', 'fdsa');
678  $callback = [
679  [
680  static::class,
681  'callbackStaticTestFunction',
682  ],
683  ];
684  // the callback function will throw an exception used to check if it was called with correct $itemName
685  $this->expectException(\InvalidArgumentException::class);
686  $this->expectExceptionCode(1336159604);
687  $subject = $this->‪getDefaultInitializedSubject();
688  $subject->getFilesInFolder('/', 0, 0, false, $callback);
689  }
690 
698  public static function ‪callbackStaticTestFunction(string $itemName): void
699  {
700  if ($itemName === 'file2') {
701  throw new \InvalidArgumentException('$itemName', 1336159604);
702  }
703  }
704 
709  {
710  file_put_contents($this->baseDirectory . '/fileA', 'asdfg');
711  file_put_contents($this->baseDirectory . '/fileB', 'fdsa');
712  $subject = $this->‪getDefaultInitializedSubject();
713  $filterCallbacks = [
714  [
715  LocalDriverFilenameFilter::class,
716  'filterFilename',
717  ],
718  ];
719  $fileList = $subject->getFilesInFolder('/', 0, 0, false, $filterCallbacks);
720  self::assertNotContains('/fileA', array_keys($fileList));
721  }
722 
727  {
728  mkdir($this->baseDirectory . '/dir1');
729  mkdir($this->baseDirectory . '/dir2');
730  file_put_contents($this->baseDirectory . '/file', 'asdfg');
731  $subject = $this->‪getDefaultInitializedSubject();
732  $fileList = $subject->getFoldersInFolder('/');
733  self::assertEquals(['/dir1/', '/dir2/'], array_keys($fileList));
734  }
735 
740  {
741  mkdir($this->baseDirectory . '/.someHiddenDir');
742  mkdir($this->baseDirectory . '/aDir');
743  file_put_contents($this->baseDirectory . '/file1', '');
744  $subject = $this->‪getDefaultInitializedSubject();
745  $fileList = $subject->getFoldersInFolder('/');
746  self::assertEquals(['/.someHiddenDir/', '/aDir/'], array_keys($fileList));
747  }
748 
755  {
756  $subject = $this->‪getDefaultInitializedSubject();
757  $fileList = $subject->getFoldersInFolder('/');
758  self::assertEmpty($fileList);
759  }
760 
765  {
766  mkdir($this->baseDirectory . '/folderA');
767  mkdir($this->baseDirectory . '/folderB');
768  $subject = $this->‪getDefaultInitializedSubject();
769  $filterCallbacks = [
770  [
771  LocalDriverFilenameFilter::class,
772  'filterFilename',
773  ],
774  ];
775  $folderList = $subject->getFoldersInFolder('/', 0, 0, false, $filterCallbacks);
776  self::assertNotContains('/folderA/', array_values($folderList));
777  }
778 
783  {
784  file_put_contents($this->baseDirectory . 'somefile', '');
785  $this->expectException(\InvalidArgumentException::class);
786  $this->expectExceptionCode(1314349666);
787  $subject = $this->‪getDefaultInitializedSubject();
788  $subject->getFoldersInFolder('somedir/');
789  }
790 
794  public function ‪hashReturnsCorrectHashes(): void
795  {
796  $expectedMd5Hash = '8c67dbaf0ba22f2e7fbc26413b86051b';
797  $expectedSha1Hash = 'a60cd808ba7a0bcfa37fa7f3fb5998e1b8dbcd9d';
798  file_put_contents($this->baseDirectory . '/hashFile', '68b329da9893e34099c7d8ad5cb9c940');
799  $subject = $this->‪getDefaultInitializedSubject();
800  self::assertEquals($expectedSha1Hash, $subject->hash('/hashFile', 'sha1'));
801  self::assertEquals($expectedMd5Hash, $subject->hash('/hashFile', 'md5'));
802  }
803 
808  {
809  $this->expectException(\InvalidArgumentException::class);
810  $this->expectExceptionCode(1304964032);
811  file_put_contents($this->baseDirectory . '/hashFile', '68b329da9893e34099c7d8ad5cb9c940');
812  $subject = $this->‪getDefaultInitializedSubject();
813  $subject->hash('/hashFile', ‪StringUtility::getUniqueId('uri_'));
814  }
815 
820  {
821  mkdir($this->baseDirectory . '/someDir');
822  file_put_contents($this->baseDirectory . '/someDir/someFile', 'asdfgh');
823  $driverConfiguration = [
824  'basePath' => ‪$this->baseDirectory,
825  ];
826  $subject = $this->getAccessibleMock(LocalDriver::class, ['copyFileToTemporaryPath'], [$driverConfiguration]);
827  $subject->processConfiguration();
828  $subject->expects(self::once())->method('copyFileToTemporaryPath');
829  $subject->getFileForLocalProcessing('/someDir/someFile');
830  }
831 
836  {
837  mkdir($this->baseDirectory . '/someDir');
838  file_put_contents($this->baseDirectory . '/someDir/someFile', 'asdfgh');
839  $subject = $this->‪getDefaultInitializedSubject();
840  $filePath = $subject->getFileForLocalProcessing('/someDir/someFile', false);
841  self::assertEquals($filePath, $this->baseDirectory . '/someDir/someFile');
842  }
843 
847  public function ‪filesCanBeCopiedToATemporaryPath(): void
848  {
849  mkdir($this->baseDirectory . '/someDir');
850  file_put_contents($this->baseDirectory . '/someDir/someFile.ext', 'asdfgh');
851  $driverConfiguration = [
852  'basePath' => ‪$this->baseDirectory,
853  ];
854  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
855  $subject->processConfiguration();
856  $filePath = $subject->_call('copyFileToTemporaryPath', '/someDir/someFile.ext');
857  self::assertStringContainsString(‪Environment::getVarPath() . '/transient/', $filePath);
858  self::assertEquals('asdfgh', file_get_contents($filePath));
859  }
860 
865  {
866  file_put_contents($this->baseDirectory . '/someFile', '');
867  chmod($this->baseDirectory . '/someFile', 448);
868  $subject = $this->‪getDefaultInitializedSubject();
869  self::assertEquals(['r' => true, 'w' => true], $subject->getPermissions('/someFile'));
870  }
871 
876  {
877  mkdir($this->baseDirectory . '/someFolder');
878  chmod($this->baseDirectory . '/someFolder', 448);
879  $subject = $this->‪getDefaultInitializedSubject();
880  self::assertEquals(['r' => true, 'w' => true], $subject->getPermissions('/someFolder'));
881  }
882 
887  {
888  $subject = $this->‪getDefaultInitializedSubject();
889  self::assertTrue($subject->isWithin('/someFolder/', '/someFolder/test.jpg'));
890  self::assertTrue($subject->isWithin('/someFolder/', '/someFolder/subFolder/test.jpg'));
891  self::assertFalse($subject->isWithin('/someFolder/', '/someFolderWithALongName/test.jpg'));
892  }
893 
898  {
899  $subject = $this->‪getDefaultInitializedSubject();
900  self::assertTrue($subject->isWithin('/someFolder/', '/someFolder/test.jpg'));
901  self::assertTrue($subject->isWithin('/someFolder/', '/someFolder/subfolder/'));
902  }
903 
907  public function ‪filesCanBeCopiedWithinStorage(): void
908  {
909  $fileContents = ‪StringUtility::getUniqueId('content_');
910  file_put_contents($this->baseDirectory . '/someFile', $fileContents);
911  mkdir($this->baseDirectory . '/targetFolder');
912  $subject = $this->‪getDefaultInitializedSubject();
913  $subject->copyFileWithinStorage('/someFile', '/targetFolder/', 'someFile');
914  self::assertFileEquals($this->baseDirectory . '/someFile', $this->baseDirectory . '/targetFolder/someFile');
915  }
916 
920  public function ‪filesCanBeMovedWithinStorage(): void
921  {
922  $fileContents = ‪StringUtility::getUniqueId('content_');
923  file_put_contents($this->baseDirectory . '/someFile', $fileContents);
924  mkdir($this->baseDirectory . '/targetFolder');
925  $subject = $this->‪getDefaultInitializedSubject();
926  $newIdentifier = $subject->moveFileWithinStorage('/someFile', '/targetFolder/', 'file');
927  self::assertEquals($fileContents, file_get_contents($this->baseDirectory . '/targetFolder/file'));
928  self::assertFileDoesNotExist($this->baseDirectory . '/someFile');
929  self::assertEquals('/targetFolder/file', $newIdentifier);
930  }
931 
936  {
937  $fileContents = ‪StringUtility::getUniqueId('content_');
938  file_put_contents($this->baseDirectory . '/someFile', $fileContents);
939  mkdir($this->baseDirectory . '/targetFolder');
940  $subject = $this->‪getDefaultInitializedSubject();
941  $newIdentifier = $subject->moveFileWithinStorage('/someFile', '/targetFolder/', 'file');
942  $fileMetadata = $subject->getFileInfoByIdentifier($newIdentifier);
943  self::assertEquals($newIdentifier, $fileMetadata['identifier']);
944  }
945 
950  {
951  file_put_contents($this->baseDirectory . '/file', '');
952  $subject = $this->‪getDefaultInitializedSubject();
953  $newIdentifier = $subject->renameFile('/file', 'newFile');
954  self::assertFileDoesNotExist($this->baseDirectory . '/file');
955  self::assertFalse($subject->fileExists('/file'));
956  self::assertFileExists($this->baseDirectory . '/newFile');
957  self::assertTrue($subject->fileExists('/newFile'));
958  self::assertEquals('/newFile', $newIdentifier);
959  }
960 
965  {
966  mkdir($this->baseDirectory . '/targetFolder');
967  file_put_contents($this->baseDirectory . '/targetFolder/file', '');
968  $subject = $this->‪getDefaultInitializedSubject();
969  $newIdentifier = $subject->renameFile('/targetFolder/file', 'newFile');
970  self::assertFileDoesNotExist($this->baseDirectory . '/targetFolder/file');
971  self::assertFalse($subject->fileExists('/targetFolder/file'));
972  self::assertFileExists($this->baseDirectory . '/targetFolder/newFile');
973  self::assertTrue($subject->fileExists('/targetFolder/newFile'));
974  self::assertEquals('/targetFolder/newFile', $newIdentifier);
975  }
976 
981  {
982  $this->expectException(ExistingTargetFileNameException::class);
983  $this->expectExceptionCode(1320291063);
984  mkdir($this->baseDirectory . '/targetFolder');
985  file_put_contents($this->baseDirectory . '/targetFolder/file', '');
986  file_put_contents($this->baseDirectory . '/targetFolder/newFile', '');
987  $subject = $this->‪getDefaultInitializedSubject();
988  $subject->renameFile('/targetFolder/file', 'newFile');
989  }
990 
995  {
996  mkdir($this->baseDirectory . '/someFolder');
997  $subject = $this->‪getDefaultInitializedSubject();
998  $mapping = $subject->renameFolder('/someFolder/', 'newFolder');
999  self::assertFileDoesNotExist($this->baseDirectory . '/someFolder');
1000  self::assertFalse($subject->folderExists('/someFolder/'));
1001  self::assertFileExists($this->baseDirectory . '/newFolder');
1002  self::assertTrue($subject->folderExists('/newFolder/'));
1003  self::assertEquals('/newFolder/', $mapping['/someFolder/']);
1004  }
1005 
1010  {
1011  mkdir($this->baseDirectory . '/subFolder');
1012  mkdir($this->baseDirectory . '/subFolder/someFolder');
1013  $subject = $this->‪getDefaultInitializedSubject();
1014  $mapping = $subject->renameFolder('/subFolder/someFolder/', 'newFolder');
1015  self::assertFileDoesNotExist($this->baseDirectory . '/subFolder/someFolder');
1016  self::assertFalse($subject->folderExists('/subFolder/someFolder'));
1017  self::assertFileExists($this->baseDirectory . '/subFolder/newFolder');
1018  self::assertTrue($subject->folderExists('/subFolder/newFolder'));
1019  self::assertEquals('/subFolder/newFolder/', $mapping['/subFolder/someFolder/']);
1020  }
1021 
1026  {
1027  mkdir($this->baseDirectory . '/sourceFolder');
1028  file_put_contents($this->baseDirectory . '/sourceFolder/file2', 'asdfg');
1029  mkdir($this->baseDirectory . '/sourceFolder/subFolder');
1030  file_put_contents($this->baseDirectory . '/sourceFolder/subFolder/file', 'asdfg');
1031  $subject = $this->‪getDefaultInitializedSubject();
1032  $mappingInformation = $subject->renameFolder('/sourceFolder/', 'newFolder');
1033  self::assertIsArray($mappingInformation);
1034  self::assertEquals('/newFolder/', $mappingInformation['/sourceFolder/']);
1035  self::assertEquals('/newFolder/file2', $mappingInformation['/sourceFolder/file2']);
1036  self::assertEquals('/newFolder/subFolder/file', $mappingInformation['/sourceFolder/subFolder/file']);
1037  self::assertEquals('/newFolder/subFolder/', $mappingInformation['/sourceFolder/subFolder/']);
1038  }
1039 
1044  {
1045  $this->expectException(\RuntimeException::class);
1046  $this->expectExceptionCode(1334160746);
1047  mkdir($this->baseDirectory . '/sourceFolder');
1048  file_put_contents($this->baseDirectory . '/sourceFolder/file', 'asdfg');
1049  $driverConfiguration = [
1050  'basePath' => ‪$this->baseDirectory,
1051  ];
1052  $subject = $this->getAccessibleMock(LocalDriver::class, ['createIdentifierMap'], [$driverConfiguration]);
1053  $subject->processConfiguration();
1054  $subject->expects(self::atLeastOnce())->method('createIdentifierMap')->will(
1055  self::throwException(
1056  new ‪FileOperationErrorException('testing', 1476045666)
1057  )
1058  );
1059  $subject->renameFolder('/sourceFolder/', 'newFolder');
1060  self::assertFileExists($this->baseDirectory . '/sourceFolder/file');
1061  }
1062 
1067  {
1068  mkdir($this->baseDirectory . '/emptyFolder');
1069  $subject = $this->‪getDefaultInitializedSubject();
1070  self::assertTrue($subject->isFolderEmpty('/emptyFolder/'));
1071  return $subject;
1072  }
1073 
1078  {
1079  mkdir($this->baseDirectory . '/folderWithFile');
1080  file_put_contents($this->baseDirectory . '/folderWithFile/someFile', '');
1081  $subject = $this->‪getDefaultInitializedSubject();
1082  self::assertFalse($subject->isFolderEmpty('/folderWithFile/'));
1083  }
1084 
1089  {
1090  mkdir($this->baseDirectory . '/folderWithSubFolder');
1091  mkdir($this->baseDirectory . '/folderWithSubFolder/someFolder');
1092  $subject = $this->‪getDefaultInitializedSubject();
1093  self::assertFalse($subject->isFolderEmpty('/folderWithSubFolder/'));
1094  }
1095 
1099  public function ‪foldersCanBeMovedWithinStorage(): void
1100  {
1101  $fileContents = ‪StringUtility::getUniqueId('content_');
1102  mkdir($this->baseDirectory . '/sourceFolder');
1103  file_put_contents($this->baseDirectory . '/sourceFolder/file', $fileContents);
1104  mkdir($this->baseDirectory . '/targetFolder');
1105  $subject = $this->‪getDefaultInitializedSubject();
1106  $subject->moveFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'someFolder');
1107  self::assertFileExists($this->baseDirectory . '/targetFolder/someFolder/');
1108  self::assertEquals($fileContents, file_get_contents($this->baseDirectory . '/targetFolder/someFolder/file'));
1109  self::assertFileDoesNotExist($this->baseDirectory . '/sourceFolder');
1110  }
1111 
1116  {
1117  mkdir($this->baseDirectory . '/targetFolder');
1118  mkdir($this->baseDirectory . '/sourceFolder');
1119  file_put_contents($this->baseDirectory . '/sourceFolder/file', 'asdfg');
1120  mkdir($this->baseDirectory . '/sourceFolder/subFolder');
1121  file_put_contents($this->baseDirectory . '/sourceFolder/subFolder/file', 'asdfg');
1122  $subject = $this->‪getDefaultInitializedSubject();
1123  $mappingInformation = $subject->moveFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'sourceFolder');
1124  self::assertEquals('/targetFolder/sourceFolder/file', $mappingInformation['/sourceFolder/file']);
1125  self::assertEquals('/targetFolder/sourceFolder/subFolder/file', $mappingInformation['/sourceFolder/subFolder/file']);
1126  self::assertEquals('/targetFolder/sourceFolder/subFolder/', $mappingInformation['/sourceFolder/subFolder/']);
1127  }
1128 
1132  public function ‪folderCanBeRenamedWhenMoving(): void
1133  {
1134  mkdir($this->baseDirectory . '/sourceFolder');
1135  file_put_contents($this->baseDirectory . '/sourceFolder/file', ‪StringUtility::getUniqueId('content_'));
1136  mkdir($this->baseDirectory . '/targetFolder');
1137  $subject = $this->‪getDefaultInitializedSubject();
1138  $subject->moveFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolder');
1139  self::assertFileExists($this->baseDirectory . '/targetFolder/newFolder/');
1140  }
1141 
1146  {
1147  mkdir($this->baseDirectory . '/sourceFolder');
1148  file_put_contents($this->baseDirectory . '/sourceFolder/file', ‪StringUtility::getUniqueId('name_'));
1149  mkdir($this->baseDirectory . '/targetFolder');
1150  $subject = $this->‪getDefaultInitializedSubject();
1151  $subject->copyFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolderName');
1152  self::assertTrue(is_file($this->baseDirectory . '/targetFolder/newFolderName/file'));
1153  }
1154 
1159  {
1160  mkdir($this->baseDirectory . '/sourceFolder');
1161  mkdir($this->baseDirectory . '/sourceFolder/subFolder');
1162  mkdir($this->baseDirectory . '/targetFolder');
1163  $subject = $this->‪getDefaultInitializedSubject();
1164  $subject->copyFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolderName');
1165  self::assertDirectoryExists($this->baseDirectory . '/targetFolder/newFolderName/subFolder');
1166  }
1167 
1172  {
1173  mkdir($this->baseDirectory . '/sourceFolder');
1174  mkdir($this->baseDirectory . '/sourceFolder/subFolder');
1175  file_put_contents($this->baseDirectory . '/sourceFolder/subFolder/file', ‪StringUtility::getUniqueId('content_'));
1176  mkdir($this->baseDirectory . '/targetFolder');
1177  $subject = $this->‪getDefaultInitializedSubject();
1178  $subject->copyFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolderName');
1179  self::assertTrue(is_file($this->baseDirectory . '/targetFolder/newFolderName/subFolder/file'));
1180  }
1181 
1188  public static function ‪sanitizeFileNameUTF8FilesystemDataProvider(): array
1189  {
1190  // Generate string containing all characters for the utf-8 Latin-1 Supplement (U+0080 to U+00FF)
1191  // without U+0080 to U+009F: control characters
1192  // Based on http://www.utf8-chartable.de/unicode-utf8-table.pl
1193  $utf8Latin1Supplement = '';
1194  for ($i = 0xA0; $i <= 0xBF; $i++) {
1195  $utf8Latin1Supplement .= chr(0xC2) . chr($i);
1196  }
1197  for ($i = 0x80; $i <= 0xBF; $i++) {
1198  $utf8Latin1Supplement .= chr(0xC3) . chr($i);
1199  }
1200  return [
1201  // Characters ordered by ASCII table
1202  'allowed characters utf-8 (ASCII part)' => [
1203  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1204  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1205  ],
1206  // Characters ordered by ASCII table (except for space-character, because space-character ist trimmed)
1207  'replace special characters with _ (not allowed characters) utf-8 (ASCII part)' => [
1208  '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1209  '_____________________________',
1210  ],
1211  'utf-8 (Latin-1 Supplement)' => [
1212  $utf8Latin1Supplement,
1213  '________________________________ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ',
1214  ],
1215  'utf-8 but not in NFC (Canonical Composition)' => [
1216  hex2bin('667275cc88686e65757a6569746c696368656e'),
1217  'frühneuzeitlichen',
1218  ],
1219  'trim leading and tailing spaces utf-8' => [
1220  ' test.txt ',
1221  'test.txt',
1222  ],
1223  'remove tailing dot' => [
1224  'test.txt.',
1225  'test.txt',
1226  ],
1227  ];
1228  }
1229 
1234  public function ‪sanitizeFileNameUTF8Filesystem(string $fileName, string $expectedResult): void
1235  {
1236  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'] = 1;
1237  $subject = $this->‪getDefaultInitializedSubject();
1238  self::assertEquals($expectedResult, $subject->sanitizeFileName($fileName));
1239  }
1240 
1248  {
1249  // Generate string containing all characters for the iso8859-1 charset, charcode greater than 127
1250  $iso88591GreaterThan127 = '';
1251  for ($i = 0xA0; $i <= 0xFF; $i++) {
1252  $iso88591GreaterThan127 .= chr($i);
1253  }
1254  // Generate string containing all characters for the utf-8 Latin-1 Supplement (U+0080 to U+00FF)
1255  // without U+0080 to U+009F: control characters
1256  // Based on http://www.utf8-chartable.de/unicode-utf8-table.pl
1257  $utf8Latin1Supplement = '';
1258  for ($i = 0xA0; $i <= 0xBF; $i++) {
1259  $utf8Latin1Supplement .= chr(0xC2) . chr($i);
1260  }
1261  for ($i = 0x80; $i <= 0xBF; $i++) {
1262  $utf8Latin1Supplement .= chr(0xC3) . chr($i);
1263  }
1264  // Generate string containing all characters for the utf-8 Latin-1 Extended-A (U+0100 to U+017F)
1265  $utf8Latin1ExtendedA = '';
1266  for ($i = 0x80; $i <= 0xBF; $i++) {
1267  $utf8Latin1ExtendedA .= chr(0xC4) . chr($i);
1268  }
1269  for ($i = 0x80; $i <= 0xBF; $i++) {
1270  $utf8Latin1ExtendedA .= chr(0xC5) . chr($i);
1271  }
1272 
1273  return [
1274  // Characters ordered by ASCII table
1275  'allowed characters iso-8859-1' => [
1276  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1277  'iso-8859-1',
1278  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1279  ],
1280  // Characters ordered by ASCII table
1281  'allowed characters utf-8' => [
1282  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1283  'utf-8',
1284  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1285  ],
1286  // Characters ordered by ASCII table (except for space-character, because space-character ist trimmed)
1287  'replace special characters with _ (not allowed characters) iso-8859-1' => [
1288  '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1289  'iso-8859-1',
1290  '_____________________________',
1291  ],
1292  // Characters ordered by ASCII table (except for space-character, because space-character ist trimmed)
1293  'replace special characters with _ (not allowed characters) utf-8' => [
1294  '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1295  'utf-8',
1296  '_____________________________',
1297  ],
1298  'iso-8859-1 (code > 127)' => [
1299  // http://de.wikipedia.org/wiki/ISO_8859-1
1300  // chr(0xA0) = NBSP (no-break space) => gets trimmed
1301  $iso88591GreaterThan127,
1302  'iso-8859-1',
1303  '_centpound_yen____c_a_____R_____-23_u___1o__1_41_23_4_AAAAAEAAAECEEEEIIIIDNOOOOOExOEUUUUEYTHssaaaaaeaaaeceeeeiiiidnoooooe_oeuuuueythy',
1304  ],
1305  'utf-8 (Latin-1 Supplement)' => [
1306  // chr(0xC2) . chr(0x0A) = NBSP (no-break space) => gets trimmed
1307  $utf8Latin1Supplement,
1308  'utf-8',
1309  '_centpound__yen______c_a_______R_______-23__u_____1o__1_41_23_4_AAAAAEAAAECEEEEIIIIDNOOOOOExOEUUUUEYTHssaaaaaeaaaeceeeeiiiidnoooooe_oeuuuueythy',
1310  ],
1311  'utf-8 (Latin-1 Extended A)' => [
1312  $utf8Latin1ExtendedA,
1313  'utf-8',
1314  'AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIJijJjKk__LlLlLlL_l_LlNnNnNn_n____OOooOoOoOEoeRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs',
1315  ],
1316  'utf-8 but not in NFC (Canonical Composition)' => [
1317  hex2bin('667275cc88686e65757a6569746c696368656e'),
1318  'utf-8',
1319  'fruehneuzeitlichen',
1320  ],
1321  'trim leading and tailing spaces iso-8859-1' => [
1322  ' test.txt ',
1323  'iso-8859-1',
1324  'test.txt',
1325  ],
1326  'trim leading and tailing spaces utf-8' => [
1327  ' test.txt ',
1328  'utf-8',
1329  'test.txt',
1330  ],
1331  'remove tailing dot iso-8859-1' => [
1332  'test.txt.',
1333  'iso-8859-1',
1334  'test.txt',
1335  ],
1336  'remove tailing dot utf-8' => [
1337  'test.txt.',
1338  'utf-8',
1339  'test.txt',
1340  ],
1341  ];
1342  }
1343 
1348  public function ‪sanitizeFileNameNonUTF8Filesystem(string $fileName, string $charset, string $expectedResult): void
1349  {
1350  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'] = 0;
1351  $subject = $this->‪getDefaultInitializedSubject();
1352  self::assertEquals($expectedResult, $subject->sanitizeFileName($fileName, $charset));
1353  }
1354 
1359  {
1360  $this->expectException(InvalidFileNameException::class);
1361  $this->expectExceptionCode(1320288991);
1362  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'] = 1;
1363  $subject = $this->‪getDefaultInitializedSubject();
1364  $subject->sanitizeFileName('');
1365  }
1366 
1371  {
1372  $this->expectException(\Exception::class);
1373  $this->expectExceptionCode(1463073434);
1374  $closure = static function () {
1375  throw new \Exception('I was called!', 1463073434);
1376  };
1377  $filterMethods = [
1378  $closure,
1379  ];
1380  $driverConfiguration = [
1381  'basePath' => ‪$this->baseDirectory,
1382  ];
1383  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
1384  $subject->processConfiguration();
1385  $subject->_call('applyFilterMethodsToDirectoryItem', $filterMethods, '', '', '');
1386  }
1387 
1392  {
1393  $dummyObject = $this->getMockBuilder(\stdClass::class)->addMethods(['dummy'])->getMock();
1394  $method = [
1395  $dummyObject,
1396  'dummy',
1397  ];
1398  $dummyObject->expects(self::once())->method('dummy');
1399  $filterMethods = [
1400  $method,
1401  ];
1402  $driverConfiguration = [
1403  'basePath' => ‪$this->baseDirectory,
1404  ];
1405  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
1406  $subject->processConfiguration();
1407  $subject->_call('applyFilterMethodsToDirectoryItem', $filterMethods, '', '', '');
1408  }
1409 }
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\basePathIsNormalizedWithTrailingSlash
‪basePathIsNormalizedWithTrailingSlash()
Definition: LocalDriverTest.php:305
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\setUp
‪setUp()
Definition: LocalDriverTest.php:37
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\applyFilterMethodsToDirectoryItemCallsFilterMethodIfName
‪applyFilterMethodsToDirectoryItemCallsFilterMethodIfName()
Definition: LocalDriverTest.php:1391
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getSpecificFileInformationDataProvider
‪static getSpecificFileInformationDataProvider()
Definition: LocalDriverTest.php:328
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderInFolderReturnsCorrectFolderObject
‪getFolderInFolderReturnsCorrectFolderObject()
Definition: LocalDriverTest.php:243
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getPublicUrlReturnsValidUrlContainingSpecialCharacters
‪getPublicUrlReturnsValidUrlContainingSpecialCharacters(string $fileIdentifier)
Definition: LocalDriverTest.php:516
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\isFolderEmptyReturnsFalseIfFolderHasFile
‪isFolderEmptyReturnsFalseIfFolderHasFile()
Definition: LocalDriverTest.php:1077
‪TYPO3\CMS\Core\Core\Environment\isUnix
‪static isUnix()
Definition: Environment.php:295
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\sanitizeFileNameThrowsExceptionOnInvalidFileName
‪sanitizeFileNameThrowsExceptionOnInvalidFileName()
Definition: LocalDriverTest.php:1358
‪TYPO3\CMS\Core\Resource\ResourceStorageInterface
Definition: ResourceStorageInterface.php:22
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesFileInSingleSubFolderToNewFolderName
‪copyFolderWithinStorageCopiesFileInSingleSubFolderToNewFolderName()
Definition: LocalDriverTest.php:1171
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderListReturnsHiddenFoldersByDefault
‪getFolderListReturnsHiddenFoldersByDefault()
Definition: LocalDriverTest.php:739
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\calculatedBasePathRelativeIsSane
‪calculatedBasePathRelativeIsSane()
Definition: LocalDriverTest.php:65
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createFolderSanitizesFolderNameBeforeCreationDataProvider
‪static createFolderSanitizesFolderNameBeforeCreationDataProvider()
Definition: LocalDriverTest.php:275
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\publicUrlIsCalculatedCorrectlyWithDifferentBasePathsAndBasUris
‪publicUrlIsCalculatedCorrectlyWithDifferentBasePathsAndBasUris(string $basePath, string $baseUri, string $fileName, bool $expectedIsPublic, ?string $expectedPublicUrl)
Definition: LocalDriverTest.php:154
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\tearDown
‪tearDown()
Definition: LocalDriverTest.php:45
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\hashReturnsCorrectHashes
‪hashReturnsCorrectHashes()
Definition: LocalDriverTest.php:794
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderListFiltersItemsWithGivenFilterMethods
‪getFolderListFiltersItemsWithGivenFilterMethods()
Definition: LocalDriverTest.php:764
‪TYPO3\CMS\Core\Resource\Driver\LocalDriver
Definition: LocalDriver.php:41
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesSingleSubFolderToNewFolderName
‪copyFolderWithinStorageCopiesSingleSubFolderToNewFolderName()
Definition: LocalDriverTest.php:1158
‪TYPO3\CMS\Core\Core\Environment\getPublicPath
‪static getPublicPath()
Definition: Environment.php:187
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renamingFilesChangesFilenameOnDiskInRootFolder
‪renamingFilesChangesFilenameOnDiskInRootFolder()
Definition: LocalDriverTest.php:949
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesSingleFileToNewFolderName
‪copyFolderWithinStorageCopiesSingleFileToNewFolderName()
Definition: LocalDriverTest.php:1145
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renamingFilesChangesFilenameOnDiskInSubFolder
‪renamingFilesChangesFilenameOnDiskInSubFolder()
Definition: LocalDriverTest.php:964
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createFolderReturnsFolderObject
‪createFolderReturnsFolderObject()
Definition: LocalDriverTest.php:266
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileForLocalProcessingCreatesCopyOfFileByDefault
‪getFileForLocalProcessingCreatesCopyOfFileByDefault()
Definition: LocalDriverTest.php:819
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\existenceChecksInFolderWorkForFilesAndFolders
‪existenceChecksInFolderWorkForFilesAndFolders()
Definition: LocalDriverTest.php:474
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\determineBaseUrlUrlEncodesUriParts
‪determineBaseUrlUrlEncodesUriParts()
Definition: LocalDriverTest.php:207
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFilesInFolderReturnsEmptyArrayForEmptyDirectory
‪getFilesInFolderReturnsEmptyArrayForEmptyDirectory()
Definition: LocalDriverTest.php:624
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\fileContentsCanBeWrittenAndRead
‪fileContentsCanBeWrittenAndRead()
Definition: LocalDriverTest.php:532
‪TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException
Definition: ExistingTargetFileNameException.php:24
‪TYPO3\CMS\Core\Core\Environment\getCurrentScript
‪static getCurrentScript()
Definition: Environment.php:220
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\defaultLevelFolderFolderIsCreatedIfItDoesntExist
‪defaultLevelFolderFolderIsCreatedIfItDoesntExist()
Definition: LocalDriverTest.php:234
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderListLeavesOutNavigationalEntries
‪getFolderListLeavesOutNavigationalEntries()
Definition: LocalDriverTest.php:754
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\sanitizeFileNameNonUTF8Filesystem
‪sanitizeFileNameNonUTF8Filesystem(string $fileName, string $charset, string $expectedResult)
Definition: LocalDriverTest.php:1348
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver
‪TYPO3\CMS\Core\Core\Environment\getVarPath
‪static getVarPath()
Definition: Environment.php:197
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\isWithinAcceptsFileAndFolderObjectsAsContent
‪isWithinAcceptsFileAndFolderObjectsAsContent()
Definition: LocalDriverTest.php:897
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getPublicUrlReturnsCorrectUriForConfiguredBaseUri
‪getPublicUrlReturnsCorrectUriForConfiguredBaseUri()
Definition: LocalDriverTest.php:489
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\Fixtures\LocalDriverFilenameFilter
Definition: LocalDriverFilenameFilter.php:24
‪TYPO3\CMS\Core\Core\Environment\getConfigPath
‪static getConfigPath()
Definition: Environment.php:212
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileReturnsCorrectIdentifier
‪getFileReturnsCorrectIdentifier()
Definition: LocalDriverTest.php:599
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getDefaultFolderReturnsFolderForUserUploadPath
‪getDefaultFolderReturnsFolderForUserUploadPath()
Definition: LocalDriverTest.php:225
‪TYPO3\CMS\Webhooks\Message\$publicUrl
‪identifier readonly string readonly string $publicUrl
Definition: FileUpdatedMessage.php:36
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createdFilesAreEmpty
‪createdFilesAreEmpty()
Definition: LocalDriverTest.php:570
‪TYPO3\CMS\Core\Core\Environment\getProjectPath
‪static string getProjectPath()
Definition: Environment.php:160
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\$initializeDatabase
‪bool $initializeDatabase
Definition: LocalDriverTest.php:33
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\addFileMovesFileToCorrectLocation
‪addFileMovesFileToCorrectLocation()
Definition: LocalDriverTest.php:407
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\$baseDirectory
‪string $baseDirectory
Definition: LocalDriverTest.php:35
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderListReturnsAllDirectoriesInDirectory
‪getFolderListReturnsAllDirectoriesInDirectory()
Definition: LocalDriverTest.php:726
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileForLocalProcessingReturnsOriginalFilepathForReadonlyAccess
‪getFileForLocalProcessingReturnsOriginalFilepathForReadonlyAccess()
Definition: LocalDriverTest.php:835
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\publicUrlIsCalculatedCorrectlyWithDifferentBasePathsAndBasUrisDataProvider
‪static publicUrlIsCalculatedCorrectlyWithDifferentBasePathsAndBasUrisDataProvider()
Definition: LocalDriverTest.php:95
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\moveFolderWithinStorageReturnsCorrectMappingInformationForAllFiles
‪moveFolderWithinStorageReturnsCorrectMappingInformationForAllFiles()
Definition: LocalDriverTest.php:1115
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileListFailsIfDirectoryDoesNotExist
‪getFileListFailsIfDirectoryDoesNotExist()
Definition: LocalDriverTest.php:663
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\isFolderEmptyReturnsTrueForEmptyFolder
‪isFolderEmptyReturnsTrueForEmptyFolder()
Definition: LocalDriverTest.php:1066
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\newFilesCanBeCreated
‪newFilesCanBeCreated()
Definition: LocalDriverTest.php:559
‪TYPO3\CMS\Core\Core\Environment\initialize
‪static initialize(ApplicationContext $context, bool $cli, bool $composerMode, string $projectPath, string $publicPath, string $varPath, string $configPath, string $currentScript, string $os)
Definition: Environment.php:100
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renameFolderReturnsCorrectMappingInformationForAllFiles
‪renameFolderReturnsCorrectMappingInformationForAllFiles()
Definition: LocalDriverTest.php:1025
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\sanitizeFileNameNonUTF8FilesystemDataProvider
‪static sanitizeFileNameNonUTF8FilesystemDataProvider()
Definition: LocalDriverTest.php:1247
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\permissionsAreCorrectlyRetrievedForAllowedFile
‪permissionsAreCorrectlyRetrievedForAllowedFile()
Definition: LocalDriverTest.php:864
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\foldersCanBeMovedWithinStorage
‪foldersCanBeMovedWithinStorage()
Definition: LocalDriverTest.php:1099
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderListFailsIfDirectoryDoesNotExist
‪getFolderListFailsIfDirectoryDoesNotExist()
Definition: LocalDriverTest.php:782
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\fileMetadataIsChangedAfterMovingFile
‪fileMetadataIsChangedAfterMovingFile()
Definition: LocalDriverTest.php:935
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\filesCanBeMovedWithinStorage
‪filesCanBeMovedWithinStorage()
Definition: LocalDriverTest.php:920
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\permissionsAreCorrectlyRetrievedForAllowedFolder
‪permissionsAreCorrectlyRetrievedForAllowedFolder()
Definition: LocalDriverTest.php:875
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getSpecificFileInformationReturnsRequestedFileInformation
‪getSpecificFileInformationReturnsRequestedFileInformation(string|int $expectedValue, string $property)
Definition: LocalDriverTest.php:378
‪TYPO3\CMS\Core\Utility\GeneralUtility\isValidUrl
‪static bool isValidUrl($url)
Definition: GeneralUtility.php:797
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renamingFilesFailsIfTargetFileExists
‪renamingFilesFailsIfTargetFileExists()
Definition: LocalDriverTest.php:980
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\folderCanBeRenamedWhenMoving
‪folderCanBeRenamedWhenMoving()
Definition: LocalDriverTest.php:1132
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileInFolderCallsConfiguredCallbackFunctionWithGivenItemName
‪getFileInFolderCallsConfiguredCallbackFunctionWithGivenItemName()
Definition: LocalDriverTest.php:675
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\sanitizeFileNameUTF8Filesystem
‪sanitizeFileNameUTF8Filesystem(string $fileName, string $expectedResult)
Definition: LocalDriverTest.php:1234
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renamingFoldersChangesFolderNameOnDiskInRootFolder
‪renamingFoldersChangesFolderNameOnDiskInRootFolder()
Definition: LocalDriverTest.php:994
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\callbackStaticTestFunction
‪static callbackStaticTestFunction(string $itemName)
Definition: LocalDriverTest.php:698
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\hashingWithUnsupportedAlgorithmFails
‪hashingWithUnsupportedAlgorithmFails()
Definition: LocalDriverTest.php:807
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\filesCanBeCopiedToATemporaryPath
‪filesCanBeCopiedToATemporaryPath()
Definition: LocalDriverTest.php:847
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getAbsolutePathReturnsCorrectPath
‪getAbsolutePathReturnsCorrectPath()
Definition: LocalDriverTest.php:392
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:41
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\isFolderEmptyReturnsFalseIfFolderHasSubfolder
‪isFolderEmptyReturnsFalseIfFolderHasSubfolder()
Definition: LocalDriverTest.php:1088
‪TYPO3\CMS\Core\Utility\GeneralUtility\rmdir
‪static bool rmdir($path, $removeNonEmpty=false)
Definition: GeneralUtility.php:1806
‪TYPO3\CMS\Core\Resource\ResourceStorageInterface\CAPABILITY_PUBLIC
‪const CAPABILITY_PUBLIC
Definition: ResourceStorageInterface.php:30
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createFileFixesPermissionsOnCreatedFile
‪createFileFixesPermissionsOnCreatedFile()
Definition: LocalDriverTest.php:582
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\sanitizeFileNameUTF8FilesystemDataProvider
‪static sanitizeFileNameUTF8FilesystemDataProvider()
Definition: LocalDriverTest.php:1188
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renamingFoldersChangesFolderNameOnDiskInSubFolder
‪renamingFoldersChangesFolderNameOnDiskInSubFolder()
Definition: LocalDriverTest.php:1009
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\filesCanBeCopiedWithinStorage
‪filesCanBeCopiedWithinStorage()
Definition: LocalDriverTest.php:907
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\applyFilterMethodsToDirectoryItemCallsFilterMethodIfClosure
‪applyFilterMethodsToDirectoryItemCallsFilterMethodIfClosure()
Definition: LocalDriverTest.php:1370
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\isWithinRecognizesFilesWithinFolderAndInOtherFolders
‪isWithinRecognizesFilesWithinFolderAndInOtherFolders()
Definition: LocalDriverTest.php:886
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:51
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createFolderRecursiveSanitizesFilename
‪createFolderRecursiveSanitizesFilename()
Definition: LocalDriverTest.php:188
‪TYPO3\CMS\Core\Resource\Exception\FileOperationErrorException
Definition: FileOperationErrorException.php:22
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:24
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getDefaultInitializedSubject
‪getDefaultInitializedSubject()
Definition: LocalDriverTest.php:52
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileThrowsExceptionIfFileDoesNotExist
‪getFileThrowsExceptionIfFileDoesNotExist()
Definition: LocalDriverTest.php:613
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileListReturnsAllFilesInDirectory
‪getFileListReturnsAllFilesInDirectory()
Definition: LocalDriverTest.php:634
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\setFileContentsReturnsNumberOfBytesWrittenToFile
‪setFileContentsReturnsNumberOfBytesWrittenToFile()
Definition: LocalDriverTest.php:546
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\noSecondSlashIsAddedIfBasePathAlreadyHasTrailingSlash
‪noSecondSlashIsAddedIfBasePathAlreadyHasTrailingSlash()
Definition: LocalDriverTest.php:318
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileListFiltersItemsWithGivenFilterMethods
‪getFileListFiltersItemsWithGivenFilterMethods()
Definition: LocalDriverTest.php:708
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileListReturnsAllFilesInSubdirectoryIfRecursiveParameterIsSet
‪getFileListReturnsAllFilesInSubdirectoryIfRecursiveParameterIsSet()
Definition: LocalDriverTest.php:647
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createFolderCreatesFolderOnDisk
‪createFolderCreatesFolderOnDisk()
Definition: LocalDriverTest.php:254
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createFolderSanitizesFolderNameBeforeCreation
‪createFolderSanitizesFolderNameBeforeCreation(string $newFolderName, string $expectedFolderName)
Definition: LocalDriverTest.php:293
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\existenceChecksWorkForFilesAndFolders
‪existenceChecksWorkForFilesAndFolders()
Definition: LocalDriverTest.php:460
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renameFolderRevertsRenamingIfFilenameMapCannotBeCreated
‪renameFolderRevertsRenamingIfFilenameMapCannotBeCreated()
Definition: LocalDriverTest.php:1043
‪TYPO3\CMS\Core\Core\Environment\getContext
‪static getContext()
Definition: Environment.php:128
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest
Definition: LocalDriverTest.php:32
‪TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException
Definition: InvalidFileNameException.php:24
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\addFileUsesFilenameIfGiven
‪addFileUsesFilenameIfGiven()
Definition: LocalDriverTest.php:420
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static getUniqueId(string $prefix='')
Definition: StringUtility.php:29
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\calculatedBasePathAbsoluteIsSane
‪calculatedBasePathAbsoluteIsSane()
Definition: LocalDriverTest.php:80
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\addFileReturnsFileIdentifier
‪addFileReturnsFileIdentifier()
Definition: LocalDriverTest.php:447
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getPublicUrlReturnsValidUrlContainingSpecialCharactersDataProvider
‪static getPublicUrlReturnsValidUrlContainingSpecialCharactersDataProvider()
Definition: LocalDriverTest.php:502
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\addFileFailsIfFileIsInDriverStorage
‪addFileFailsIfFileIsInDriverStorage()
Definition: LocalDriverTest.php:433
‪TYPO3\CMS\Core\Core\Environment\isWindows
‪static isWindows()
Definition: Environment.php:287