‪TYPO3CMS  10.4
AbstractHierarchicalFilesystemDriverTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 
25 {
29  protected ‪$subject;
30 
31  protected function ‪setUp(): void
32  {
33  parent::setUp();
34  $this->subject = $this->getAccessibleMockForAbstractClass(AbstractHierarchicalFilesystemDriver::class, [], '', false);
35  }
36 
43  public function ‪canonicalizeAndCheckFileIdentifierCanonicalizesPath($expectedPath, $fileIdentifier)
44  {
45  self::assertSame($expectedPath, $this->subject->_call('canonicalizeAndCheckFileIdentifier', $fileIdentifier));
46  }
47 
52  {
53  return [
54  'File path gets leading slash' => [
55  '/foo.php',
56  'foo.php',
57  ],
58  'Absolute path to file is not modified' => [
59  '/bar/foo.php',
60  '/bar/foo.php',
61  ],
62  'Relative path to file gets leading slash' => [
63  '/bar/foo.php',
64  'bar/foo.php',
65  ],
66  'Empty string is returned as empty string' => [
67  '',
68  '',
69  ],
70  'Double slashes in path are removed' => [
71  '/bar/foo.php',
72  '/bar//foo.php',
73  ],
74  'Trailing point in path is removed' => [
75  '/foo.php',
76  './foo.php',
77  ],
78  'Point is replaced by slash' => [
79  '/',
80  '.',
81  ],
82  './ becomes /' => [
83  '/',
84  './',
85  ]
86  ];
87  }
88 
95  public function ‪canonicalizeAndCheckFolderIdentifierCanonicalizesFolderIdentifier($expectedPath, $identifier)
96  {
97  self::assertSame($expectedPath, $this->subject->_call('canonicalizeAndCheckFolderIdentifier', $identifier));
98  }
99 
104  {
105  return [
106  'Empty string results in slash' => [
107  '/',
108  '',
109  ],
110  'Single point results in slash' => [
111  '/',
112  '.',
113  ],
114  'Single slash results in single slash' => [
115  '/',
116  '/',
117  ],
118  'Double slash results in single slash' => [
119  '/',
120  '//',
121  ],
122  'Absolute folder paths without trailing slash gets a trailing slash' => [
123  '/foo/',
124  '/foo',
125  ],
126  'Absolute path with trailing and leading slash is not modified' => [
127  '/foo/',
128  '/foo/',
129  ],
130  'Relative path to folder becomes absolute path with trailing slash' => [
131  '/foo/',
132  'foo/',
133  ],
134  ];
135  }
136 }
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\AbstractHierarchicalFilesystemDriverTest
Definition: AbstractHierarchicalFilesystemDriverTest.php:25
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\AbstractHierarchicalFilesystemDriverTest\canonicalizeAndCheckFileIdentifierCanonicalizesPath
‪canonicalizeAndCheckFileIdentifierCanonicalizesPath($expectedPath, $fileIdentifier)
Definition: AbstractHierarchicalFilesystemDriverTest.php:42
‪TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver
Definition: AbstractHierarchicalFilesystemDriver.php:26
‪TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase
Definition: BaseTestCase.php:29
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\AbstractHierarchicalFilesystemDriverTest\$subject
‪AbstractHierarchicalFilesystemDriver PHPUnit Framework MockObject MockObject TYPO3 TestingFramework Core AccessibleObjectInterface $subject
Definition: AbstractHierarchicalFilesystemDriverTest.php:28
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver
Definition: AbstractDriverTest.php:16
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\AbstractHierarchicalFilesystemDriverTest\canonicalizeAndCheckFileIdentifierCanonicalizesPathDataProvider
‪array canonicalizeAndCheckFileIdentifierCanonicalizesPathDataProvider()
Definition: AbstractHierarchicalFilesystemDriverTest.php:50
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\AbstractHierarchicalFilesystemDriverTest\canonicalizeAndCheckFolderIdentifierCanonicalizesFolderIdentifierDataProvider
‪array canonicalizeAndCheckFolderIdentifierCanonicalizesFolderIdentifierDataProvider()
Definition: AbstractHierarchicalFilesystemDriverTest.php:102
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\AbstractHierarchicalFilesystemDriverTest\setUp
‪setUp()
Definition: AbstractHierarchicalFilesystemDriverTest.php:30
‪TYPO3\CMS\Core\Tests\Unit\Resource\Driver\AbstractHierarchicalFilesystemDriverTest\canonicalizeAndCheckFolderIdentifierCanonicalizesFolderIdentifier
‪canonicalizeAndCheckFolderIdentifierCanonicalizesFolderIdentifier($expectedPath, $identifier)
Definition: AbstractHierarchicalFilesystemDriverTest.php:94