‪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 
20 use PHPUnit\Framework\Attributes\DataProvider;
21 use PHPUnit\Framework\Attributes\Test;
24 use TYPO3\CMS\Core\Resource\Driver\LocalDriver;
31 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
32 
33 final class ‪LocalDriverTest extends FunctionalTestCase
34 {
35  protected bool ‪$initializeDatabase = false;
36 
37  private string ‪$baseDirectory;
38 
39  protected function ‪setUp(): void
40  {
41  parent::setUp();
42  $this->baseDirectory = $this->instancePath . '/local-driver-tests';
43  mkdir($this->baseDirectory);
44  mkdir(‪Environment::getVarPath() . '/tests');
45  }
46 
47  protected function ‪tearDown(): void
48  {
49  ‪GeneralUtility::rmdir($this->instancePath . '/local-driver-tests', true);
51  parent::tearDown();
52  }
53 
54  private function ‪getDefaultInitializedSubject(): LocalDriver
55  {
56  $driverConfiguration = [
57  'basePath' => ‪$this->baseDirectory,
58  ];
59  $subject = new LocalDriver($driverConfiguration);
60  $subject->processConfiguration();
61  return $subject;
62  }
63 
64  #[Test]
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 
77  #[Test]
78  public function ‪calculatedBasePathAbsoluteIsSane(): void
79  {
80  // This test checks if "/../" are properly filtered out (i.e. from "Base path" field of sys_file_storage)
81  $varPath = ‪Environment::getVarPath();
82  $projectPath = ‪Environment::getProjectPath();
83  $relativeVarPath = str_replace($projectPath, '', $varPath);
84  $segments = str_repeat('/..', substr_count($relativeVarPath, '/') + 1);
85  $relativeDriverConfiguration = [
86  'basePath' => ‪Environment::getVarPath() . '/tests' . $segments . $relativeVarPath . '/tests/',
87  ];
88  $subject = $this->getAccessibleMock(LocalDriver::class, null);
89  $basePath = $subject->_call('calculateBasePath', $relativeDriverConfiguration);
90  self::assertStringNotContainsString('/../', $basePath);
91  }
92 
94  {
95  return [
96  'no base uri, within public' => [
97  '/files/',
98  '',
99  '/foo.txt',
100  true,
101  'files/foo.txt',
102  ],
103  'no base uri, within project' => [
104  '/../files/',
105  '',
106  '/foo.txt',
107  false,
108  null,
109  ],
110  'base uri with host, within public' => [
111  '/files/',
112  'https://host.tld/',
113  '/foo.txt',
114  true,
115  'https://host.tld/foo.txt',
116  ],
117  'base uri with host, within project' => [
118  '/../files/',
119  'https://host.tld/',
120  '/foo.txt',
121  true,
122  'https://host.tld/foo.txt',
123  ],
124  'base uri with path only, within public' => [
125  '/files/',
126  'assets/',
127  '/foo.txt',
128  true,
129  'assets/foo.txt',
130  ],
131  'base uri with path only, within project' => [
132  '/../files/',
133  'assets/',
134  '/foo.txt',
135  true,
136  'assets/foo.txt',
137  ],
138  'base uri with path only, within other public dir' => [
139  '/../public/assets/',
140  'assets/',
141  '/foo.txt',
142  true,
143  'assets/foo.txt',
144  ],
145  ];
146  }
147 
148  #[DataProvider('publicUrlIsCalculatedCorrectlyWithDifferentBasePathsAndBasUrisDataProvider')]
149  #[Test]
150  public function ‪publicUrlIsCalculatedCorrectlyWithDifferentBasePathsAndBasUris(string $basePath, string $baseUri, string $fileName, bool $expectedIsPublic, ?string $expectedPublicUrl): void
151  {
152  $projectPath = $this->baseDirectory . '/app';
153  $publicPath = $projectPath . '/public';
154  $absoluteBaseDir = $publicPath . $basePath;
155  mkdir($projectPath);
156  mkdir($publicPath);
157  mkdir($absoluteBaseDir, 0777, true);
160  true,
161  false,
162  $projectPath,
163  $publicPath,
167  ‪Environment::isUnix() ? 'UNIX' : 'WINDOWS'
168  );
169  $driverConfiguration = [
170  'pathType' => 'relative',
171  'basePath' => $basePath,
172  'baseUri' => $baseUri,
173  ];
174  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
175  $subject->processConfiguration();
176  self::assertSame($expectedIsPublic, $subject->hasCapability(‪Capabilities::CAPABILITY_PUBLIC));
177  self::assertSame($fileName, $subject->createFile($fileName, '/'));
178  self::assertSame($expectedPublicUrl, $subject->getPublicUrl($fileName));
179  }
180 
181  #[Test]
183  {
184  $driverConfiguration = [
185  'basePath' => ‪$this->baseDirectory,
186  ];
187  $subject = $this->getAccessibleMock(LocalDriver::class, ['sanitizeFilename'], [$driverConfiguration]);
188  $subject->processConfiguration();
189  $subject->expects(self::exactly(2))
190  ->method('sanitizeFileName')
191  ->willReturn(
192  'sanitized'
193  );
194  $subject->createFolder('newFolder/andSubfolder', '/', true);
195  self::assertFileExists($this->baseDirectory . '/sanitized/sanitized');
196  }
197 
198  #[Test]
200  {
201  $subject = $this->getAccessibleMock(LocalDriver::class, ['hasCapability'], [], '', false);
202  $subject->expects(self::once())
203  ->method('hasCapability')
205  ->willReturn(
206  true
207  );
208  $subject->_set('absoluteBasePath', ‪Environment::getPublicPath() . '/un encö/ded %path/');
209  $subject->_call('determineBaseUrl');
210  $baseUri = $subject->_get('baseUri');
211  self::assertEquals(rawurlencode('un encö') . '/' . rawurlencode('ded %path') . '/', $baseUri);
212  }
213 
214  #[Test]
216  {
217  $subject = $this->‪getDefaultInitializedSubject();
218  self::assertEquals('/user_upload/', $subject->getDefaultFolder());
219  }
220 
221  #[Test]
223  {
224  $subject = $this->‪getDefaultInitializedSubject();
225  self::assertFileExists($this->baseDirectory . '/' . $subject->getDefaultFolder());
226  }
227 
228  #[Test]
230  {
231  mkdir($this->baseDirectory . '/someDir');
232  mkdir($this->baseDirectory . '/someDir/someSubdir');
233  $subject = $this->‪getDefaultInitializedSubject();
234  self::assertEquals('/someDir/someSubdir/', $subject->getFolderInFolder('someSubdir', '/someDir/'));
235  }
236 
237  #[Test]
238  public function ‪createFolderCreatesFolderOnDisk(): void
239  {
240  mkdir($this->baseDirectory . '/some');
241  mkdir($this->baseDirectory . '/some/folder');
242  $subject = $this->‪getDefaultInitializedSubject();
243  $subject->createFolder('path', '/some/folder/');
244  self::assertFileExists($this->baseDirectory . '/some/folder/path');
245  }
246 
247  #[Test]
248  public function ‪createFolderReturnsFolderObject(): void
249  {
250  mkdir($this->baseDirectory . '/some');
251  mkdir($this->baseDirectory . '/some/folder');
252  $subject = $this->‪getDefaultInitializedSubject();
253  $createdFolder = $subject->createFolder('path', '/some/folder/');
254  self::assertEquals('/some/folder/path/', $createdFolder);
255  }
256 
258  {
259  return [
260  'folder name with NULL character' => [
261  'some' . "\0" . 'Folder',
262  'some_Folder',
263  ],
264  'folder name with directory part' => [
265  '../someFolder',
266  '.._someFolder',
267  ],
268  ];
269  }
270 
271  #[DataProvider('createFolderSanitizesFolderNameBeforeCreationDataProvider')]
272  #[Test]
273  public function ‪createFolderSanitizesFolderNameBeforeCreation(string $newFolderName, string $expectedFolderName): void
274  {
275  mkdir($this->baseDirectory . '/some');
276  mkdir($this->baseDirectory . '/some/folder');
277  $subject = $this->‪getDefaultInitializedSubject();
278  $subject->createFolder($newFolderName, '/some/folder/');
279  self::assertFileExists($this->baseDirectory . '/some/folder/' . $expectedFolderName);
280  }
281 
282  #[Test]
284  {
285  $driverConfiguration = [
286  'basePath' => ‪$this->baseDirectory,
287  ];
288  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
289  $subject->processConfiguration();
290  self::assertEquals('/', substr($subject->_call('getAbsoluteBasePath'), -1));
291  }
292 
293  #[Test]
295  {
296  $driverConfiguration = [
297  'basePath' => ‪$this->baseDirectory,
298  ];
299  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
300  $subject->processConfiguration();
301  self::assertNotEquals('/', substr($subject->_call('getAbsoluteBasePath'), -2, 1));
302  }
303 
304  public static function ‪getSpecificFileInformationDataProvider(): array
305  {
306  return [
307  'size' => [
308  'expectedValue' => filesize(__DIR__ . '/Fixtures/Dummy.html'),
309  'propertyName' => 'size',
310  ],
311  'atime' => [
312  'expectedValue' => 'WILL_BE_REPLACED_BY_VFS_TIME',
313  'propertyName' => 'atime',
314  ],
315  'mtime' => [
316  'expectedValue' => 'WILL_BE_REPLACED_BY_VFS_TIME',
317  'propertyName' => 'mtime',
318  ],
319  'ctime' => [
320  'expectedValue' => 'WILL_BE_REPLACED_BY_VFS_TIME',
321  'propertyName' => 'ctime',
322  ],
323  'name' => [
324  'expectedValue' => 'Dummy.html',
325  'propertyName' => 'name',
326  ],
327  'mimetype' => [
328  'expectedValue' => 'text/html',
329  'propertyName' => 'mimetype',
330  ],
331  'identifier' => [
332  'expectedValue' => '/Dummy.html',
333  'propertyName' => 'identifier',
334  ],
335  'storage' => [
336  'expectedValue' => 5,
337  'propertyName' => 'storage',
338  ],
339  'identifier_hash' => [
340  'expectedValue' => 'b11efa5d7c0556a65c6aa261343b9807cac993bc',
341  'propertyName' => 'identifier_hash',
342  ],
343  'folder_hash' => [
344  'expectedValue' => '42099b4af021e53fd8fd4e056c2568d7c2e3ffa8',
345  'propertyName' => 'folder_hash',
346  ],
347  ];
348  }
349 
350  #[DataProvider('getSpecificFileInformationDataProvider')]
351  #[Test]
352  public function ‪getSpecificFileInformationReturnsRequestedFileInformation(string|int $expectedValue, string $propertyName): void
353  {
354  copy(__DIR__ . '/Fixtures/Dummy.html', $this->baseDirectory . '/Dummy.html');
355  if (in_array($propertyName, ['mtime', 'ctime', 'atime'])) {
356  $expectedValue = filemtime($this->baseDirectory . '/Dummy.html');
357  }
358  $subject = $this->‪getDefaultInitializedSubject();
359  $subject->setStorageUid(5);
360  self::assertSame($expectedValue, $subject->getSpecificFileInformation($this->baseDirectory . '/Dummy.html', '/', $propertyName));
361  }
362 
363  #[Test]
364  public function ‪getAbsolutePathReturnsCorrectPath(): void
365  {
366  mkdir($this->baseDirectory . '/someFolder');
367  file_put_contents($this->baseDirectory . '/someFolder/file1.ext', 'asdfg');
368  $driverConfiguration = [
369  'basePath' => ‪$this->baseDirectory,
370  ];
371  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
372  $subject->processConfiguration();
373  self::assertEquals($this->baseDirectory . '/someFolder/file1.ext', $subject->_call('getAbsolutePath', '/someFolder/file1.ext'));
374  }
375 
376  #[Test]
377  public function ‪addFileMovesFileToCorrectLocation(): void
378  {
379  mkdir($this->baseDirectory . '/targetFolder');
380  mkdir($this->baseDirectory . '/sourceFolder');
381  file_put_contents($this->baseDirectory . '/sourceFolder/file', 'asdf');
382  $subject = $this->‪getDefaultInitializedSubject();
383  $subject->addFile($this->baseDirectory . '/sourceFolder/file', '/targetFolder/', 'file');
384  self::assertFileExists($this->baseDirectory . '/targetFolder/file');
385  }
386 
387  #[Test]
388  public function ‪addFileUsesFilenameIfGiven(): void
389  {
390  mkdir($this->baseDirectory . '/targetFolder');
391  mkdir($this->baseDirectory . '/sourceFolder');
392  file_put_contents($this->baseDirectory . '/sourceFolder/file', 'asdf');
393  $subject = $this->‪getDefaultInitializedSubject();
394  $subject->addFile($this->baseDirectory . '/sourceFolder/file', '/targetFolder/', 'targetFile');
395  self::assertFileExists($this->baseDirectory . '/targetFolder/targetFile');
396  }
397 
398  #[Test]
400  {
401  $this->expectException(\InvalidArgumentException::class);
402  $this->expectExceptionCode(1314778269);
403  mkdir($this->baseDirectory . '/targetFolder');
404  file_put_contents($this->baseDirectory . '/targetFolder/file', 'asdf');
405  $subject = $this->‪getDefaultInitializedSubject();
406  $subject->setStorageUid(5);
407  $subject->addFile($this->baseDirectory . '/targetFolder/file', '/targetFolder/', 'file');
408  }
409 
410  #[Test]
411  public function ‪addFileReturnsFileIdentifier(): void
412  {
413  mkdir($this->baseDirectory . '/targetFolder');
414  mkdir($this->baseDirectory . '/sourceFolder');
415  file_put_contents($this->baseDirectory . '/sourceFolder/file', 'asdf');
416  $subject = $this->‪getDefaultInitializedSubject();
417  $fileIdentifier = $subject->addFile($this->baseDirectory . '/sourceFolder/file', '/targetFolder/', 'file');
418  self::assertEquals('/targetFolder/file', $fileIdentifier);
419  }
420 
421  #[Test]
423  {
424  mkdir($this->baseDirectory . '/folder');
425  file_put_contents($this->baseDirectory . '/file', 'asdf');
426  $subject = $this->‪getDefaultInitializedSubject();
427  self::assertTrue($subject->fileExists('/file'));
428  self::assertTrue($subject->folderExists('/folder/'));
429  self::assertFalse($subject->fileExists('/nonexistingFile'));
430  self::assertFalse($subject->folderExists('/nonexistingFolder/'));
431  }
432 
433  #[Test]
435  {
436  mkdir($this->baseDirectory . '/subfolder');
437  file_put_contents($this->baseDirectory . '/subfolder/file', 'asdf');
438  mkdir($this->baseDirectory . '/subfolder/folder');
439  $subject = $this->‪getDefaultInitializedSubject();
440  self::assertTrue($subject->fileExistsInFolder('file', '/subfolder/'));
441  self::assertTrue($subject->folderExistsInFolder('folder', '/subfolder/'));
442  self::assertFalse($subject->fileExistsInFolder('nonexistingFile', '/subfolder/'));
443  self::assertFalse($subject->folderExistsInFolder('nonexistingFolder', '/subfolder/'));
444  }
445 
446  #[Test]
448  {
449  $baseUri = 'https://example.org/foobar/' . ‪StringUtility::getUniqueId('uri_');
450  $driverConfiguration = [
451  'baseUri' => $baseUri,
452  'basePath' => ‪$this->baseDirectory,
453  ];
454  $subject = new LocalDriver($driverConfiguration);
455  $subject->processConfiguration();
456  self::assertEquals($baseUri . '/file.ext', $subject->getPublicUrl('/file.ext'));
457  self::assertEquals($baseUri . '/subfolder/file2.ext', $subject->getPublicUrl('/subfolder/file2.ext'));
458  }
459 
461  {
462  return [
463  ['/single file with some special chars äüö!.txt'],
464  ['/on subfolder/with special chars äüö!.ext'],
465  ['/who names a file like !"§$%&()=?*+~"#\'´`<>-.ext'],
466  ['no leading slash !"§$%&()=?*+~#\'"´`"<>-.txt'],
467  ];
468  }
469 
470  #[DataProvider('getPublicUrlReturnsValidUrlContainingSpecialCharactersDataProvider')]
471  #[Test]
472  public function ‪getPublicUrlReturnsValidUrlContainingSpecialCharacters(string $fileIdentifier): void
473  {
474  $baseUri = 'https://example.org/foobar/' . ‪StringUtility::getUniqueId('uri_');
475  $driverConfiguration = [
476  'baseUri' => $baseUri,
477  'basePath' => ‪$this->baseDirectory,
478  ];
479  $subject = new LocalDriver($driverConfiguration);
480  $subject->processConfiguration();
481  ‪$publicUrl = $subject->getPublicUrl($fileIdentifier);
482  self::assertTrue(‪GeneralUtility::isValidUrl(‪$publicUrl));
483  }
484 
485  #[Test]
486  public function ‪fileContentsCanBeWrittenAndRead(): void
487  {
488  $fileContents = 'asdf';
489  file_put_contents($this->baseDirectory . '/file.ext', $fileContents);
490  $subject = $this->‪getDefaultInitializedSubject();
491  self::assertEquals($fileContents, $subject->getFileContents('/file.ext'));
492  $newFileContents = 'asdfgh';
493  $subject->setFileContents('/file.ext', $newFileContents);
494  self::assertEquals($newFileContents, $subject->getFileContents('/file.ext'));
495  }
496 
497  #[Test]
499  {
500  $fileContents = 'asdf';
501  file_put_contents($this->baseDirectory . '/file.ext', $fileContents);
502  $subject = $this->‪getDefaultInitializedSubject();
503  $newFileContents = 'asdfgh';
504  $bytesWritten = $subject->setFileContents('/file.ext', $newFileContents);
505  self::assertEquals(strlen($newFileContents), $bytesWritten);
506  }
507 
508  #[Test]
509  public function ‪newFilesCanBeCreated(): void
510  {
511  $subject = $this->‪getDefaultInitializedSubject();
512  $subject->createFile('testfile.txt', '/');
513  self::assertFileExists($this->baseDirectory . '/testfile.txt');
514  self::assertTrue($subject->fileExists('/testfile.txt'));
515  }
516 
517  #[Test]
518  public function ‪createdFilesAreEmpty(): void
519  {
520  $subject = $this->‪getDefaultInitializedSubject();
521  $subject->createFile('testfile.txt', '/');
522  self::assertSame('', file_get_contents($this->baseDirectory . '/testfile.txt'));
523  $fileData = $subject->getFileContents('/testfile.txt');
524  self::assertEquals(0, strlen($fileData));
525  }
526 
527  #[Test]
529  {
531  self::markTestSkipped('createdFilesHaveCorrectRights() tests not available on Windows');
532  }
533  // No one will use this as his default file create mask, we hopefully don't get any false positives
534  $testPattern = '0646';
535  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = $testPattern;
536  mkdir($this->baseDirectory . '/someDir');
537  $subject = $this->‪getDefaultInitializedSubject();
538  $subject->createFile('testfile.txt', '/someDir');
539  self::assertEquals((int)$testPattern, (int)(decoct(fileperms($this->baseDirectory . '/someDir/testfile.txt') & 0777)));
540  }
541 
542  #[Test]
543  public function ‪getFileReturnsCorrectIdentifier(): void
544  {
545  copy(__DIR__ . '/Fixtures/Dummy.html', $this->baseDirectory . '/Dummy.html');
546  copy(__DIR__ . '/Fixtures/LocalDriverFilenameFilter.php', $this->baseDirectory . '/LocalDriverFilenameFilter.php');
547  $subject = $this->‪getDefaultInitializedSubject();
548  $fileInfo = $subject->getFileInfoByIdentifier('Dummy.html');
549  self::assertEquals('/Dummy.html', $fileInfo['identifier']);
550  $fileInfo = $subject->getFileInfoByIdentifier('LocalDriverFilenameFilter.php');
551  self::assertEquals('/LocalDriverFilenameFilter.php', $fileInfo['identifier']);
552  }
553 
554  #[Test]
556  {
557  $this->expectException(\InvalidArgumentException::class);
558  $this->expectExceptionCode(1314516809);
559  $subject = $this->‪getDefaultInitializedSubject();
560  $subject->getFileInfoByIdentifier('/some/file/at/a/random/path');
561  }
562 
563  #[Test]
565  {
566  $subject = $this->‪getDefaultInitializedSubject();
567  $fileList = $subject->getFilesInFolder('/');
568  self::assertEmpty($fileList);
569  }
570 
571  #[Test]
573  {
574  mkdir($this->baseDirectory . '/aDir');
575  file_put_contents($this->baseDirectory . '/file1', 'asdfg');
576  file_put_contents($this->baseDirectory . '/file2', 'fdsa');
577  $subject = $this->‪getDefaultInitializedSubject();
578  $fileList = $subject->getFilesInFolder('/');
579  self::assertEquals(['/file1', '/file2'], array_keys($fileList));
580  }
581 
582  #[Test]
584  {
585  mkdir($this->baseDirectory . '/aDir');
586  file_put_contents($this->baseDirectory . '/aDir/file3', 'asdfgh');
587  mkdir($this->baseDirectory . '/aDir/subDir');
588  file_put_contents($this->baseDirectory . '/aDir/subDir/file4', 'asklfjklasjkl');
589  file_put_contents($this->baseDirectory . '/file1', 'asdfg');
590  file_put_contents($this->baseDirectory . '/file2', 'fdsa');
591  $subject = $this->‪getDefaultInitializedSubject();
592  $fileList = $subject->getFilesInFolder('/', 0, 0, true);
593  self::assertEquals(['/file1', '/file2', '/aDir/file3', '/aDir/subDir/file4'], array_keys($fileList));
594  }
595 
596  #[Test]
598  {
599  $this->expectException(\InvalidArgumentException::class);
600  $this->expectExceptionCode(1314349666);
601  file_put_contents($this->baseDirectory . '/somefile', '');
602  $subject = $this->‪getDefaultInitializedSubject();
603  $subject->getFilesInFolder('somedir/');
604  }
605 
606  #[Test]
608  {
609  file_put_contents($this->baseDirectory . '/file2', 'fdsa');
610  $callback = [
611  [
612  static::class,
613  'callbackStaticTestFunction',
614  ],
615  ];
616  // the callback function will throw an exception used to check if it was called with correct $itemName
617  $this->expectException(\InvalidArgumentException::class);
618  $this->expectExceptionCode(1336159604);
619  $subject = $this->‪getDefaultInitializedSubject();
620  $subject->getFilesInFolder('/', 0, 0, false, $callback);
621  }
622 
630  public static function ‪callbackStaticTestFunction(string $itemName): void
631  {
632  if ($itemName === 'file2') {
633  throw new \InvalidArgumentException('$itemName', 1336159604);
634  }
635  }
636 
637  #[Test]
639  {
640  file_put_contents($this->baseDirectory . '/fileA', 'asdfg');
641  file_put_contents($this->baseDirectory . '/fileB', 'fdsa');
642  $subject = $this->‪getDefaultInitializedSubject();
643  $filterCallbacks = [
644  [
645  LocalDriverFilenameFilter::class,
646  'filterFilename',
647  ],
648  ];
649  $fileList = $subject->getFilesInFolder('/', 0, 0, false, $filterCallbacks);
650  self::assertNotContains('/fileA', array_keys($fileList));
651  }
652 
653  #[Test]
655  {
656  mkdir($this->baseDirectory . '/dir1');
657  mkdir($this->baseDirectory . '/dir2');
658  file_put_contents($this->baseDirectory . '/file', 'asdfg');
659  $subject = $this->‪getDefaultInitializedSubject();
660  $fileList = $subject->getFoldersInFolder('/');
661  self::assertEquals(['/dir1/', '/dir2/'], array_keys($fileList));
662  }
663 
664  #[Test]
666  {
667  mkdir($this->baseDirectory . '/.someHiddenDir');
668  mkdir($this->baseDirectory . '/aDir');
669  file_put_contents($this->baseDirectory . '/file1', '');
670  $subject = $this->‪getDefaultInitializedSubject();
671  $fileList = $subject->getFoldersInFolder('/');
672  self::assertEquals(['/.someHiddenDir/', '/aDir/'], array_keys($fileList));
673  }
674 
678  #[Test]
680  {
681  $subject = $this->‪getDefaultInitializedSubject();
682  $fileList = $subject->getFoldersInFolder('/');
683  self::assertEmpty($fileList);
684  }
685 
686  #[Test]
688  {
689  mkdir($this->baseDirectory . '/folderA');
690  mkdir($this->baseDirectory . '/folderB');
691  $subject = $this->‪getDefaultInitializedSubject();
692  $filterCallbacks = [
693  [
694  LocalDriverFilenameFilter::class,
695  'filterFilename',
696  ],
697  ];
698  $folderList = $subject->getFoldersInFolder('/', 0, 0, false, $filterCallbacks);
699  self::assertNotContains('/folderA/', array_values($folderList));
700  }
701 
702  #[Test]
704  {
705  file_put_contents($this->baseDirectory . 'somefile', '');
706  $this->expectException(\InvalidArgumentException::class);
707  $this->expectExceptionCode(1314349666);
708  $subject = $this->‪getDefaultInitializedSubject();
709  $subject->getFoldersInFolder('somedir/');
710  }
711 
712  #[Test]
713  public function ‪hashReturnsCorrectHashes(): void
714  {
715  $expectedMd5Hash = '8c67dbaf0ba22f2e7fbc26413b86051b';
716  $expectedSha1Hash = 'a60cd808ba7a0bcfa37fa7f3fb5998e1b8dbcd9d';
717  file_put_contents($this->baseDirectory . '/hashFile', '68b329da9893e34099c7d8ad5cb9c940');
718  $subject = $this->‪getDefaultInitializedSubject();
719  self::assertEquals($expectedSha1Hash, $subject->hash('/hashFile', 'sha1'));
720  self::assertEquals($expectedMd5Hash, $subject->hash('/hashFile', 'md5'));
721  }
722 
723  #[Test]
725  {
726  $this->expectException(\InvalidArgumentException::class);
727  $this->expectExceptionCode(1304964032);
728  file_put_contents($this->baseDirectory . '/hashFile', '68b329da9893e34099c7d8ad5cb9c940');
729  $subject = $this->‪getDefaultInitializedSubject();
730  $subject->hash('/hashFile', ‪StringUtility::getUniqueId('uri_'));
731  }
732 
733  #[Test]
735  {
736  mkdir($this->baseDirectory . '/someDir');
737  file_put_contents($this->baseDirectory . '/someDir/someFile', 'asdfgh');
738  $driverConfiguration = [
739  'basePath' => ‪$this->baseDirectory,
740  ];
741  $subject = $this->getAccessibleMock(LocalDriver::class, ['copyFileToTemporaryPath'], [$driverConfiguration]);
742  $subject->processConfiguration();
743  $subject->expects(self::once())->method('copyFileToTemporaryPath')->willReturn('');
744  $subject->getFileForLocalProcessing('/someDir/someFile');
745  }
746 
747  #[Test]
749  {
750  mkdir($this->baseDirectory . '/someDir');
751  file_put_contents($this->baseDirectory . '/someDir/someFile', 'asdfgh');
752  $subject = $this->‪getDefaultInitializedSubject();
753  $filePath = $subject->getFileForLocalProcessing('/someDir/someFile', false);
754  self::assertEquals($filePath, $this->baseDirectory . '/someDir/someFile');
755  }
756 
757  #[Test]
758  public function ‪filesCanBeCopiedToATemporaryPath(): void
759  {
760  mkdir($this->baseDirectory . '/someDir');
761  file_put_contents($this->baseDirectory . '/someDir/someFile.ext', 'asdfgh');
762  $driverConfiguration = [
763  'basePath' => ‪$this->baseDirectory,
764  ];
765  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
766  $subject->processConfiguration();
767  $filePath = $subject->_call('copyFileToTemporaryPath', '/someDir/someFile.ext');
768  self::assertStringContainsString(‪Environment::getVarPath() . '/transient/', $filePath);
769  self::assertEquals('asdfgh', file_get_contents($filePath));
770  }
771 
772  #[Test]
774  {
775  file_put_contents($this->baseDirectory . '/someFile', '');
776  chmod($this->baseDirectory . '/someFile', 448);
777  $subject = $this->‪getDefaultInitializedSubject();
778  self::assertEquals(['r' => true, 'w' => true], $subject->getPermissions('/someFile'));
779  }
780 
781  #[Test]
783  {
784  mkdir($this->baseDirectory . '/someFolder');
785  chmod($this->baseDirectory . '/someFolder', 448);
786  $subject = $this->‪getDefaultInitializedSubject();
787  self::assertEquals(['r' => true, 'w' => true], $subject->getPermissions('/someFolder'));
788  }
789 
790  #[Test]
792  {
793  $subject = $this->‪getDefaultInitializedSubject();
794  self::assertTrue($subject->isWithin('/someFolder/', '/someFolder/test.jpg'));
795  self::assertTrue($subject->isWithin('/someFolder/', '/someFolder/subFolder/test.jpg'));
796  self::assertFalse($subject->isWithin('/someFolder/', '/someFolderWithALongName/test.jpg'));
797  }
798 
799  #[Test]
801  {
802  $subject = $this->‪getDefaultInitializedSubject();
803  self::assertTrue($subject->isWithin('/someFolder/', '/someFolder/test.jpg'));
804  self::assertTrue($subject->isWithin('/someFolder/', '/someFolder/subfolder/'));
805  }
806 
807  #[Test]
808  public function ‪filesCanBeCopiedWithinStorage(): void
809  {
810  $fileContents = ‪StringUtility::getUniqueId('content_');
811  file_put_contents($this->baseDirectory . '/someFile', $fileContents);
812  mkdir($this->baseDirectory . '/targetFolder');
813  $subject = $this->‪getDefaultInitializedSubject();
814  $subject->copyFileWithinStorage('/someFile', '/targetFolder/', 'someFile');
815  self::assertFileEquals($this->baseDirectory . '/someFile', $this->baseDirectory . '/targetFolder/someFile');
816  }
817 
818  #[Test]
819  public function ‪filesCanBeMovedWithinStorage(): void
820  {
821  $fileContents = ‪StringUtility::getUniqueId('content_');
822  file_put_contents($this->baseDirectory . '/someFile', $fileContents);
823  mkdir($this->baseDirectory . '/targetFolder');
824  $subject = $this->‪getDefaultInitializedSubject();
825  $newIdentifier = $subject->moveFileWithinStorage('/someFile', '/targetFolder/', 'file');
826  self::assertEquals($fileContents, file_get_contents($this->baseDirectory . '/targetFolder/file'));
827  self::assertFileDoesNotExist($this->baseDirectory . '/someFile');
828  self::assertEquals('/targetFolder/file', $newIdentifier);
829  }
830 
831  #[Test]
833  {
834  $fileContents = ‪StringUtility::getUniqueId('content_');
835  file_put_contents($this->baseDirectory . '/someFile', $fileContents);
836  mkdir($this->baseDirectory . '/targetFolder');
837  $subject = $this->‪getDefaultInitializedSubject();
838  $newIdentifier = $subject->moveFileWithinStorage('/someFile', '/targetFolder/', 'file');
839  $fileMetadata = $subject->getFileInfoByIdentifier($newIdentifier);
840  self::assertEquals($newIdentifier, $fileMetadata['identifier']);
841  }
842 
843  #[Test]
845  {
846  file_put_contents($this->baseDirectory . '/file', '');
847  $subject = $this->‪getDefaultInitializedSubject();
848  $newIdentifier = $subject->renameFile('/file', 'newFile');
849  self::assertFileDoesNotExist($this->baseDirectory . '/file');
850  self::assertFalse($subject->fileExists('/file'));
851  self::assertFileExists($this->baseDirectory . '/newFile');
852  self::assertTrue($subject->fileExists('/newFile'));
853  self::assertEquals('/newFile', $newIdentifier);
854  }
855 
856  #[Test]
858  {
859  mkdir($this->baseDirectory . '/targetFolder');
860  file_put_contents($this->baseDirectory . '/targetFolder/file', '');
861  $subject = $this->‪getDefaultInitializedSubject();
862  $newIdentifier = $subject->renameFile('/targetFolder/file', 'newFile');
863  self::assertFileDoesNotExist($this->baseDirectory . '/targetFolder/file');
864  self::assertFalse($subject->fileExists('/targetFolder/file'));
865  self::assertFileExists($this->baseDirectory . '/targetFolder/newFile');
866  self::assertTrue($subject->fileExists('/targetFolder/newFile'));
867  self::assertEquals('/targetFolder/newFile', $newIdentifier);
868  }
869 
870  #[Test]
872  {
873  $this->expectException(ExistingTargetFileNameException::class);
874  $this->expectExceptionCode(1320291063);
875  mkdir($this->baseDirectory . '/targetFolder');
876  file_put_contents($this->baseDirectory . '/targetFolder/file', '');
877  file_put_contents($this->baseDirectory . '/targetFolder/newFile', '');
878  $subject = $this->‪getDefaultInitializedSubject();
879  $subject->renameFile('/targetFolder/file', 'newFile');
880  }
881 
882  #[Test]
884  {
885  mkdir($this->baseDirectory . '/someFolder');
886  $subject = $this->‪getDefaultInitializedSubject();
887  $mapping = $subject->renameFolder('/someFolder/', 'newFolder');
888  self::assertFileDoesNotExist($this->baseDirectory . '/someFolder');
889  self::assertFalse($subject->folderExists('/someFolder/'));
890  self::assertFileExists($this->baseDirectory . '/newFolder');
891  self::assertTrue($subject->folderExists('/newFolder/'));
892  self::assertEquals('/newFolder/', $mapping['/someFolder/']);
893  }
894 
895  #[Test]
897  {
898  mkdir($this->baseDirectory . '/subFolder');
899  mkdir($this->baseDirectory . '/subFolder/someFolder');
900  $subject = $this->‪getDefaultInitializedSubject();
901  $mapping = $subject->renameFolder('/subFolder/someFolder/', 'newFolder');
902  self::assertFileDoesNotExist($this->baseDirectory . '/subFolder/someFolder');
903  self::assertFalse($subject->folderExists('/subFolder/someFolder'));
904  self::assertFileExists($this->baseDirectory . '/subFolder/newFolder');
905  self::assertTrue($subject->folderExists('/subFolder/newFolder'));
906  self::assertEquals('/subFolder/newFolder/', $mapping['/subFolder/someFolder/']);
907  }
908 
909  #[Test]
911  {
912  mkdir($this->baseDirectory . '/sourceFolder');
913  file_put_contents($this->baseDirectory . '/sourceFolder/file2', 'asdfg');
914  mkdir($this->baseDirectory . '/sourceFolder/subFolder');
915  file_put_contents($this->baseDirectory . '/sourceFolder/subFolder/file', 'asdfg');
916  $subject = $this->‪getDefaultInitializedSubject();
917  $mappingInformation = $subject->renameFolder('/sourceFolder/', 'newFolder');
918  self::assertIsArray($mappingInformation);
919  self::assertEquals('/newFolder/', $mappingInformation['/sourceFolder/']);
920  self::assertEquals('/newFolder/file2', $mappingInformation['/sourceFolder/file2']);
921  self::assertEquals('/newFolder/subFolder/file', $mappingInformation['/sourceFolder/subFolder/file']);
922  self::assertEquals('/newFolder/subFolder/', $mappingInformation['/sourceFolder/subFolder/']);
923  }
924 
925  #[Test]
927  {
928  $this->expectException(\RuntimeException::class);
929  $this->expectExceptionCode(1334160746);
930  mkdir($this->baseDirectory . '/sourceFolder');
931  file_put_contents($this->baseDirectory . '/sourceFolder/file', 'asdfg');
932  $driverConfiguration = [
933  'basePath' => ‪$this->baseDirectory,
934  ];
935  $subject = $this->getAccessibleMock(LocalDriver::class, ['createIdentifierMap'], [$driverConfiguration]);
936  $subject->processConfiguration();
937  $subject->expects(self::atLeastOnce())->method('createIdentifierMap')->will(
938  self::throwException(
939  new ‪FileOperationErrorException('testing', 1476045666)
940  )
941  );
942  $subject->renameFolder('/sourceFolder/', 'newFolder');
943  self::assertFileExists($this->baseDirectory . '/sourceFolder/file');
944  }
945 
946  #[Test]
947  public function ‪isFolderEmptyReturnsTrueForEmptyFolder(): LocalDriver
948  {
949  mkdir($this->baseDirectory . '/emptyFolder');
950  $subject = $this->‪getDefaultInitializedSubject();
951  self::assertTrue($subject->isFolderEmpty('/emptyFolder/'));
952  return $subject;
953  }
954 
955  #[Test]
957  {
958  mkdir($this->baseDirectory . '/folderWithFile');
959  file_put_contents($this->baseDirectory . '/folderWithFile/someFile', '');
960  $subject = $this->‪getDefaultInitializedSubject();
961  self::assertFalse($subject->isFolderEmpty('/folderWithFile/'));
962  }
963 
964  #[Test]
966  {
967  mkdir($this->baseDirectory . '/folderWithSubFolder');
968  mkdir($this->baseDirectory . '/folderWithSubFolder/someFolder');
969  $subject = $this->‪getDefaultInitializedSubject();
970  self::assertFalse($subject->isFolderEmpty('/folderWithSubFolder/'));
971  }
972 
973  #[Test]
974  public function ‪foldersCanBeMovedWithinStorage(): void
975  {
976  $fileContents = ‪StringUtility::getUniqueId('content_');
977  mkdir($this->baseDirectory . '/sourceFolder');
978  file_put_contents($this->baseDirectory . '/sourceFolder/file', $fileContents);
979  mkdir($this->baseDirectory . '/targetFolder');
980  $subject = $this->‪getDefaultInitializedSubject();
981  $subject->moveFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'someFolder');
982  self::assertFileExists($this->baseDirectory . '/targetFolder/someFolder/');
983  self::assertEquals($fileContents, file_get_contents($this->baseDirectory . '/targetFolder/someFolder/file'));
984  self::assertFileDoesNotExist($this->baseDirectory . '/sourceFolder');
985  }
986 
987  #[Test]
989  {
990  mkdir($this->baseDirectory . '/targetFolder');
991  mkdir($this->baseDirectory . '/sourceFolder');
992  file_put_contents($this->baseDirectory . '/sourceFolder/file', 'asdfg');
993  mkdir($this->baseDirectory . '/sourceFolder/subFolder');
994  file_put_contents($this->baseDirectory . '/sourceFolder/subFolder/file', 'asdfg');
995  $subject = $this->‪getDefaultInitializedSubject();
996  $mappingInformation = $subject->moveFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'sourceFolder');
997  self::assertEquals('/targetFolder/sourceFolder/file', $mappingInformation['/sourceFolder/file']);
998  self::assertEquals('/targetFolder/sourceFolder/subFolder/file', $mappingInformation['/sourceFolder/subFolder/file']);
999  self::assertEquals('/targetFolder/sourceFolder/subFolder/', $mappingInformation['/sourceFolder/subFolder/']);
1000  }
1001 
1002  #[Test]
1003  public function ‪folderCanBeRenamedWhenMoving(): void
1004  {
1005  mkdir($this->baseDirectory . '/sourceFolder');
1006  file_put_contents($this->baseDirectory . '/sourceFolder/file', ‪StringUtility::getUniqueId('content_'));
1007  mkdir($this->baseDirectory . '/targetFolder');
1008  $subject = $this->‪getDefaultInitializedSubject();
1009  $subject->moveFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolder');
1010  self::assertFileExists($this->baseDirectory . '/targetFolder/newFolder/');
1011  }
1012 
1013  #[Test]
1015  {
1016  mkdir($this->baseDirectory . '/sourceFolder');
1017  file_put_contents($this->baseDirectory . '/sourceFolder/file', ‪StringUtility::getUniqueId('name_'));
1018  mkdir($this->baseDirectory . '/targetFolder');
1019  $subject = $this->‪getDefaultInitializedSubject();
1020  $subject->copyFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolderName');
1021  self::assertTrue(is_file($this->baseDirectory . '/targetFolder/newFolderName/file'));
1022  }
1023 
1024  #[Test]
1026  {
1027  mkdir($this->baseDirectory . '/sourceFolder');
1028  mkdir($this->baseDirectory . '/sourceFolder/subFolder');
1029  mkdir($this->baseDirectory . '/targetFolder');
1030  $subject = $this->‪getDefaultInitializedSubject();
1031  $subject->copyFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolderName');
1032  self::assertDirectoryExists($this->baseDirectory . '/targetFolder/newFolderName/subFolder');
1033  }
1034 
1035  #[Test]
1037  {
1038  mkdir($this->baseDirectory . '/sourceFolder');
1039  mkdir($this->baseDirectory . '/sourceFolder/subFolder');
1040  file_put_contents($this->baseDirectory . '/sourceFolder/subFolder/file', ‪StringUtility::getUniqueId('content_'));
1041  mkdir($this->baseDirectory . '/targetFolder');
1042  $subject = $this->‪getDefaultInitializedSubject();
1043  $subject->copyFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolderName');
1044  self::assertTrue(is_file($this->baseDirectory . '/targetFolder/newFolderName/subFolder/file'));
1045  }
1046 
1053  public static function ‪sanitizeFileNameUTF8FilesystemDataProvider(): array
1054  {
1055  // Generate string containing all characters for the utf-8 Latin-1 Supplement (U+0080 to U+00FF)
1056  // without U+0080 to U+009F: control characters
1057  // Based on http://www.utf8-chartable.de/unicode-utf8-table.pl
1058  $utf8Latin1Supplement = '';
1059  for ($i = 0xA0; $i <= 0xBF; $i++) {
1060  $utf8Latin1Supplement .= chr(0xC2) . chr($i);
1061  }
1062  for ($i = 0x80; $i <= 0xBF; $i++) {
1063  $utf8Latin1Supplement .= chr(0xC3) . chr($i);
1064  }
1065  return [
1066  // Characters ordered by ASCII table
1067  'allowed characters utf-8 (ASCII part)' => [
1068  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1069  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1070  ],
1071  // Characters ordered by ASCII table (except for space-character, because space-character ist trimmed)
1072  'replace special characters with _ (not allowed characters) utf-8 (ASCII part)' => [
1073  '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1074  '_____________________________',
1075  ],
1076  'utf-8 (Latin-1 Supplement)' => [
1077  $utf8Latin1Supplement,
1078  '________________________________ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ',
1079  ],
1080  'utf-8 but not in NFC (Canonical Composition)' => [
1081  hex2bin('667275cc88686e65757a6569746c696368656e'),
1082  'frühneuzeitlichen',
1083  ],
1084  'trim leading and tailing spaces utf-8' => [
1085  ' test.txt ',
1086  'test.txt',
1087  ],
1088  'remove tailing dot' => [
1089  'test.txt.',
1090  'test.txt',
1091  ],
1092  ];
1093  }
1094 
1095  #[DataProvider('sanitizeFileNameUTF8FilesystemDataProvider')]
1096  #[Test]
1097  public function ‪sanitizeFileNameUTF8Filesystem(string $fileName, string $expectedResult): void
1098  {
1099  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'] = 1;
1100  $subject = $this->‪getDefaultInitializedSubject();
1101  self::assertEquals($expectedResult, $subject->sanitizeFileName($fileName));
1102  }
1103 
1111  {
1112  // Generate string containing all characters for the iso8859-1 charset, charcode greater than 127
1113  $iso88591GreaterThan127 = '';
1114  for ($i = 0xA0; $i <= 0xFF; $i++) {
1115  $iso88591GreaterThan127 .= chr($i);
1116  }
1117  // Generate string containing all characters for the utf-8 Latin-1 Supplement (U+0080 to U+00FF)
1118  // without U+0080 to U+009F: control characters
1119  // Based on http://www.utf8-chartable.de/unicode-utf8-table.pl
1120  $utf8Latin1Supplement = '';
1121  for ($i = 0xA0; $i <= 0xBF; $i++) {
1122  $utf8Latin1Supplement .= chr(0xC2) . chr($i);
1123  }
1124  for ($i = 0x80; $i <= 0xBF; $i++) {
1125  $utf8Latin1Supplement .= chr(0xC3) . chr($i);
1126  }
1127  // Generate string containing all characters for the utf-8 Latin-1 Extended-A (U+0100 to U+017F)
1128  $utf8Latin1ExtendedA = '';
1129  for ($i = 0x80; $i <= 0xBF; $i++) {
1130  $utf8Latin1ExtendedA .= chr(0xC4) . chr($i);
1131  }
1132  for ($i = 0x80; $i <= 0xBF; $i++) {
1133  $utf8Latin1ExtendedA .= chr(0xC5) . chr($i);
1134  }
1135 
1136  return [
1137  // Characters ordered by ASCII table
1138  'allowed characters iso-8859-1' => [
1139  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1140  'iso-8859-1',
1141  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1142  ],
1143  // Characters ordered by ASCII table
1144  'allowed characters utf-8' => [
1145  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1146  'utf-8',
1147  '-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
1148  ],
1149  // Characters ordered by ASCII table (except for space-character, because space-character ist trimmed)
1150  'replace special characters with _ (not allowed characters) iso-8859-1' => [
1151  '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1152  'iso-8859-1',
1153  '_____________________________',
1154  ],
1155  // Characters ordered by ASCII table (except for space-character, because space-character ist trimmed)
1156  'replace special characters with _ (not allowed characters) utf-8' => [
1157  '! "#$%&\'()*+,/:;<=>?[\\]^`{|}~',
1158  'utf-8',
1159  '_____________________________',
1160  ],
1161  'iso-8859-1 (code > 127)' => [
1162  // http://de.wikipedia.org/wiki/ISO_8859-1
1163  // chr(0xA0) = NBSP (no-break space) => gets trimmed
1164  $iso88591GreaterThan127,
1165  'iso-8859-1',
1166  '_centpound_yen____c_a_____R_____-23_u___1o__1_41_23_4_AAAAAEAAAECEEEEIIIIDNOOOOOExOEUUUUEYTHssaaaaaeaaaeceeeeiiiidnoooooe_oeuuuueythy',
1167  ],
1168  'utf-8 (Latin-1 Supplement)' => [
1169  // chr(0xC2) . chr(0x0A) = NBSP (no-break space) => gets trimmed
1170  $utf8Latin1Supplement,
1171  'utf-8',
1172  '_centpound__yen______c_a_______R_______-23__u_____1o__1_41_23_4_AAAAAEAAAECEEEEIIIIDNOOOOOExOEUUUUEYTHssaaaaaeaaaeceeeeiiiidnoooooe_oeuuuueythy',
1173  ],
1174  'utf-8 (Latin-1 Extended A)' => [
1175  $utf8Latin1ExtendedA,
1176  'utf-8',
1177  'AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIJijJjKk__LlLlLlL_l_LlNnNnNn_n____OOooOoOoOEoeRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs',
1178  ],
1179  'utf-8 but not in NFC (Canonical Composition)' => [
1180  hex2bin('667275cc88686e65757a6569746c696368656e'),
1181  'utf-8',
1182  'fruehneuzeitlichen',
1183  ],
1184  'trim leading and tailing spaces iso-8859-1' => [
1185  ' test.txt ',
1186  'iso-8859-1',
1187  'test.txt',
1188  ],
1189  'trim leading and tailing spaces utf-8' => [
1190  ' test.txt ',
1191  'utf-8',
1192  'test.txt',
1193  ],
1194  'remove tailing dot iso-8859-1' => [
1195  'test.txt.',
1196  'iso-8859-1',
1197  'test.txt',
1198  ],
1199  'remove tailing dot utf-8' => [
1200  'test.txt.',
1201  'utf-8',
1202  'test.txt',
1203  ],
1204  ];
1205  }
1206 
1207  #[DataProvider('sanitizeFileNameNonUTF8FilesystemDataProvider')]
1208  #[Test]
1209  public function ‪sanitizeFileNameNonUTF8Filesystem(string $fileName, string $charset, string $expectedResult): void
1210  {
1211  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'] = 0;
1212  $subject = $this->‪getDefaultInitializedSubject();
1213  self::assertEquals($expectedResult, $subject->sanitizeFileName($fileName, $charset));
1214  }
1215 
1216  #[Test]
1218  {
1219  $this->expectException(InvalidFileNameException::class);
1220  $this->expectExceptionCode(1320288991);
1221  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'] = 1;
1222  $subject = $this->‪getDefaultInitializedSubject();
1223  $subject->sanitizeFileName('');
1224  }
1225 
1226  #[Test]
1228  {
1229  $this->expectException(\Exception::class);
1230  $this->expectExceptionCode(1463073434);
1231  $closure = static function () {
1232  throw new \Exception('I was called!', 1463073434);
1233  };
1234  $filterMethods = [
1235  $closure,
1236  ];
1237  $driverConfiguration = [
1238  'basePath' => ‪$this->baseDirectory,
1239  ];
1240  $subject = $this->getAccessibleMock(LocalDriver::class, null, [$driverConfiguration]);
1241  $subject->processConfiguration();
1242  $subject->_call('applyFilterMethodsToDirectoryItem', $filterMethods, '', '', '');
1243  }
1244 }
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\basePathIsNormalizedWithTrailingSlash
‪basePathIsNormalizedWithTrailingSlash()
Definition: LocalDriverTest.php:283
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\setUp
‪setUp()
Definition: LocalDriverTest.php:39
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getSpecificFileInformationDataProvider
‪static getSpecificFileInformationDataProvider()
Definition: LocalDriverTest.php:304
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderInFolderReturnsCorrectFolderObject
‪getFolderInFolderReturnsCorrectFolderObject()
Definition: LocalDriverTest.php:229
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getPublicUrlReturnsValidUrlContainingSpecialCharacters
‪getPublicUrlReturnsValidUrlContainingSpecialCharacters(string $fileIdentifier)
Definition: LocalDriverTest.php:472
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\isFolderEmptyReturnsFalseIfFolderHasFile
‪isFolderEmptyReturnsFalseIfFolderHasFile()
Definition: LocalDriverTest.php:956
‪TYPO3\CMS\Core\Core\Environment\isUnix
‪static isUnix()
Definition: Environment.php:284
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\sanitizeFileNameThrowsExceptionOnInvalidFileName
‪sanitizeFileNameThrowsExceptionOnInvalidFileName()
Definition: LocalDriverTest.php:1217
‪TYPO3\CMS\Core\Resource\Capabilities\CAPABILITY_PUBLIC
‪const CAPABILITY_PUBLIC
Definition: Capabilities.php:31
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesFileInSingleSubFolderToNewFolderName
‪copyFolderWithinStorageCopiesFileInSingleSubFolderToNewFolderName()
Definition: LocalDriverTest.php:1036
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderListReturnsHiddenFoldersByDefault
‪getFolderListReturnsHiddenFoldersByDefault()
Definition: LocalDriverTest.php:665
‪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:257
‪TYPO3\CMS\Core\Resource\Capabilities
Definition: Capabilities.php:23
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\publicUrlIsCalculatedCorrectlyWithDifferentBasePathsAndBasUris
‪publicUrlIsCalculatedCorrectlyWithDifferentBasePathsAndBasUris(string $basePath, string $baseUri, string $fileName, bool $expectedIsPublic, ?string $expectedPublicUrl)
Definition: LocalDriverTest.php:150
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\tearDown
‪tearDown()
Definition: LocalDriverTest.php:47
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\hashReturnsCorrectHashes
‪hashReturnsCorrectHashes()
Definition: LocalDriverTest.php:713
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderListFiltersItemsWithGivenFilterMethods
‪getFolderListFiltersItemsWithGivenFilterMethods()
Definition: LocalDriverTest.php:687
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesSingleSubFolderToNewFolderName
‪copyFolderWithinStorageCopiesSingleSubFolderToNewFolderName()
Definition: LocalDriverTest.php:1025
‪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:844
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesSingleFileToNewFolderName
‪copyFolderWithinStorageCopiesSingleFileToNewFolderName()
Definition: LocalDriverTest.php:1014
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renamingFilesChangesFilenameOnDiskInSubFolder
‪renamingFilesChangesFilenameOnDiskInSubFolder()
Definition: LocalDriverTest.php:857
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createFolderReturnsFolderObject
‪createFolderReturnsFolderObject()
Definition: LocalDriverTest.php:248
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileForLocalProcessingCreatesCopyOfFileByDefault
‪getFileForLocalProcessingCreatesCopyOfFileByDefault()
Definition: LocalDriverTest.php:734
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\existenceChecksInFolderWorkForFilesAndFolders
‪existenceChecksInFolderWorkForFilesAndFolders()
Definition: LocalDriverTest.php:434
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\determineBaseUrlUrlEncodesUriParts
‪determineBaseUrlUrlEncodesUriParts()
Definition: LocalDriverTest.php:199
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFilesInFolderReturnsEmptyArrayForEmptyDirectory
‪getFilesInFolderReturnsEmptyArrayForEmptyDirectory()
Definition: LocalDriverTest.php:564
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\fileContentsCanBeWrittenAndRead
‪fileContentsCanBeWrittenAndRead()
Definition: LocalDriverTest.php:486
‪TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException
Definition: ExistingTargetFileNameException.php:23
‪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:222
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderListLeavesOutNavigationalEntries
‪getFolderListLeavesOutNavigationalEntries()
Definition: LocalDriverTest.php:679
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\sanitizeFileNameNonUTF8Filesystem
‪sanitizeFileNameNonUTF8Filesystem(string $fileName, string $charset, string $expectedResult)
Definition: LocalDriverTest.php:1209
‪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:800
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getPublicUrlReturnsCorrectUriForConfiguredBaseUri
‪getPublicUrlReturnsCorrectUriForConfiguredBaseUri()
Definition: LocalDriverTest.php:447
‪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:543
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getDefaultFolderReturnsFolderForUserUploadPath
‪getDefaultFolderReturnsFolderForUserUploadPath()
Definition: LocalDriverTest.php:215
‪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:518
‪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:35
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\addFileMovesFileToCorrectLocation
‪addFileMovesFileToCorrectLocation()
Definition: LocalDriverTest.php:377
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\$baseDirectory
‪string $baseDirectory
Definition: LocalDriverTest.php:37
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderListReturnsAllDirectoriesInDirectory
‪getFolderListReturnsAllDirectoriesInDirectory()
Definition: LocalDriverTest.php:654
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileForLocalProcessingReturnsOriginalFilepathForReadonlyAccess
‪getFileForLocalProcessingReturnsOriginalFilepathForReadonlyAccess()
Definition: LocalDriverTest.php:748
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\publicUrlIsCalculatedCorrectlyWithDifferentBasePathsAndBasUrisDataProvider
‪static publicUrlIsCalculatedCorrectlyWithDifferentBasePathsAndBasUrisDataProvider()
Definition: LocalDriverTest.php:93
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\moveFolderWithinStorageReturnsCorrectMappingInformationForAllFiles
‪moveFolderWithinStorageReturnsCorrectMappingInformationForAllFiles()
Definition: LocalDriverTest.php:988
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileListFailsIfDirectoryDoesNotExist
‪getFileListFailsIfDirectoryDoesNotExist()
Definition: LocalDriverTest.php:597
‪TYPO3\CMS\Core\Utility\GeneralUtility\rmdir
‪static bool rmdir(string $path, bool $removeNonEmpty=false)
Definition: GeneralUtility.php:1697
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\isFolderEmptyReturnsTrueForEmptyFolder
‪isFolderEmptyReturnsTrueForEmptyFolder()
Definition: LocalDriverTest.php:947
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\newFilesCanBeCreated
‪newFilesCanBeCreated()
Definition: LocalDriverTest.php:509
‪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:910
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\sanitizeFileNameNonUTF8FilesystemDataProvider
‪static sanitizeFileNameNonUTF8FilesystemDataProvider()
Definition: LocalDriverTest.php:1110
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\permissionsAreCorrectlyRetrievedForAllowedFile
‪permissionsAreCorrectlyRetrievedForAllowedFile()
Definition: LocalDriverTest.php:773
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\foldersCanBeMovedWithinStorage
‪foldersCanBeMovedWithinStorage()
Definition: LocalDriverTest.php:974
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFolderListFailsIfDirectoryDoesNotExist
‪getFolderListFailsIfDirectoryDoesNotExist()
Definition: LocalDriverTest.php:703
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getSpecificFileInformationReturnsRequestedFileInformation
‪getSpecificFileInformationReturnsRequestedFileInformation(string|int $expectedValue, string $propertyName)
Definition: LocalDriverTest.php:352
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\fileMetadataIsChangedAfterMovingFile
‪fileMetadataIsChangedAfterMovingFile()
Definition: LocalDriverTest.php:832
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\filesCanBeMovedWithinStorage
‪filesCanBeMovedWithinStorage()
Definition: LocalDriverTest.php:819
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\permissionsAreCorrectlyRetrievedForAllowedFolder
‪permissionsAreCorrectlyRetrievedForAllowedFolder()
Definition: LocalDriverTest.php:782
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renamingFilesFailsIfTargetFileExists
‪renamingFilesFailsIfTargetFileExists()
Definition: LocalDriverTest.php:871
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\folderCanBeRenamedWhenMoving
‪folderCanBeRenamedWhenMoving()
Definition: LocalDriverTest.php:1003
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileInFolderCallsConfiguredCallbackFunctionWithGivenItemName
‪getFileInFolderCallsConfiguredCallbackFunctionWithGivenItemName()
Definition: LocalDriverTest.php:607
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\sanitizeFileNameUTF8Filesystem
‪sanitizeFileNameUTF8Filesystem(string $fileName, string $expectedResult)
Definition: LocalDriverTest.php:1097
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renamingFoldersChangesFolderNameOnDiskInRootFolder
‪renamingFoldersChangesFolderNameOnDiskInRootFolder()
Definition: LocalDriverTest.php:883
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\callbackStaticTestFunction
‪static callbackStaticTestFunction(string $itemName)
Definition: LocalDriverTest.php:630
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\hashingWithUnsupportedAlgorithmFails
‪hashingWithUnsupportedAlgorithmFails()
Definition: LocalDriverTest.php:724
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\filesCanBeCopiedToATemporaryPath
‪filesCanBeCopiedToATemporaryPath()
Definition: LocalDriverTest.php:758
‪$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:364
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:41
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\isFolderEmptyReturnsFalseIfFolderHasSubfolder
‪isFolderEmptyReturnsFalseIfFolderHasSubfolder()
Definition: LocalDriverTest.php:965
‪TYPO3\CMS\Core\Utility\GeneralUtility\isValidUrl
‪static bool isValidUrl(string $url)
Definition: GeneralUtility.php:708
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createFileFixesPermissionsOnCreatedFile
‪createFileFixesPermissionsOnCreatedFile()
Definition: LocalDriverTest.php:528
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\sanitizeFileNameUTF8FilesystemDataProvider
‪static sanitizeFileNameUTF8FilesystemDataProvider()
Definition: LocalDriverTest.php:1053
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renamingFoldersChangesFolderNameOnDiskInSubFolder
‪renamingFoldersChangesFolderNameOnDiskInSubFolder()
Definition: LocalDriverTest.php:896
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\filesCanBeCopiedWithinStorage
‪filesCanBeCopiedWithinStorage()
Definition: LocalDriverTest.php:808
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\applyFilterMethodsToDirectoryItemCallsFilterMethodIfClosure
‪applyFilterMethodsToDirectoryItemCallsFilterMethodIfClosure()
Definition: LocalDriverTest.php:1227
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\isWithinRecognizesFilesWithinFolderAndInOtherFolders
‪isWithinRecognizesFilesWithinFolderAndInOtherFolders()
Definition: LocalDriverTest.php:791
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createFolderRecursiveSanitizesFilename
‪createFolderRecursiveSanitizesFilename()
Definition: LocalDriverTest.php:182
‪TYPO3\CMS\Core\Resource\Exception\FileOperationErrorException
Definition: FileOperationErrorException.php:21
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:24
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getDefaultInitializedSubject
‪getDefaultInitializedSubject()
Definition: LocalDriverTest.php:54
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileThrowsExceptionIfFileDoesNotExist
‪getFileThrowsExceptionIfFileDoesNotExist()
Definition: LocalDriverTest.php:555
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileListReturnsAllFilesInDirectory
‪getFileListReturnsAllFilesInDirectory()
Definition: LocalDriverTest.php:572
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\setFileContentsReturnsNumberOfBytesWrittenToFile
‪setFileContentsReturnsNumberOfBytesWrittenToFile()
Definition: LocalDriverTest.php:498
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\noSecondSlashIsAddedIfBasePathAlreadyHasTrailingSlash
‪noSecondSlashIsAddedIfBasePathAlreadyHasTrailingSlash()
Definition: LocalDriverTest.php:294
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileListFiltersItemsWithGivenFilterMethods
‪getFileListFiltersItemsWithGivenFilterMethods()
Definition: LocalDriverTest.php:638
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getFileListReturnsAllFilesInSubdirectoryIfRecursiveParameterIsSet
‪getFileListReturnsAllFilesInSubdirectoryIfRecursiveParameterIsSet()
Definition: LocalDriverTest.php:583
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createFolderCreatesFolderOnDisk
‪createFolderCreatesFolderOnDisk()
Definition: LocalDriverTest.php:238
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\createFolderSanitizesFolderNameBeforeCreation
‪createFolderSanitizesFolderNameBeforeCreation(string $newFolderName, string $expectedFolderName)
Definition: LocalDriverTest.php:273
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\existenceChecksWorkForFilesAndFolders
‪existenceChecksWorkForFilesAndFolders()
Definition: LocalDriverTest.php:422
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\renameFolderRevertsRenamingIfFilenameMapCannotBeCreated
‪renameFolderRevertsRenamingIfFilenameMapCannotBeCreated()
Definition: LocalDriverTest.php:926
‪TYPO3\CMS\Core\Core\Environment\getContext
‪static getContext()
Definition: Environment.php:128
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest
Definition: LocalDriverTest.php:34
‪TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException
Definition: InvalidFileNameException.php:23
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\addFileUsesFilenameIfGiven
‪addFileUsesFilenameIfGiven()
Definition: LocalDriverTest.php:388
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static getUniqueId(string $prefix='')
Definition: StringUtility.php:57
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\calculatedBasePathAbsoluteIsSane
‪calculatedBasePathAbsoluteIsSane()
Definition: LocalDriverTest.php:78
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\addFileReturnsFileIdentifier
‪addFileReturnsFileIdentifier()
Definition: LocalDriverTest.php:411
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getPublicUrlReturnsValidUrlContainingSpecialCharactersDataProvider
‪static getPublicUrlReturnsValidUrlContainingSpecialCharactersDataProvider()
Definition: LocalDriverTest.php:460
‪TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\addFileFailsIfFileIsInDriverStorage
‪addFileFailsIfFileIsInDriverStorage()
Definition: LocalDriverTest.php:399
‪TYPO3\CMS\Core\Core\Environment\isWindows
‪static isWindows()
Definition: Environment.php:276