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