TYPO3 CMS  TYPO3_6-2
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 = NULL;
29 
30  public function setUp() {
31  parent::setUp();
32  $this->subject = $this->getAccessibleMockForAbstractClass(
33  '\\TYPO3\\CMS\\Core\\Resource\\Driver\\AbstractHierarchicalFilesystemDriver',
34  array(),
35  '',
36  FALSE
37  );
38  }
39 
46  public function canonicalizeAndCheckFileIdentifierCanonicalizesPath($expectedPath, $fileIdentifier) {
47  $this->assertSame($expectedPath, $this->subject->_callRef('canonicalizeAndCheckFileIdentifier', $fileIdentifier));
48  }
49 
54  return array(
55  'File path gets leading slash' => array(
56  '/foo.php',
57  'foo.php',
58  ),
59  'Absolute path to file is not modified' => array(
60  '/bar/foo.php',
61  '/bar/foo.php',
62  ),
63  'Relative path to file gets leading slash' => array(
64  '/bar/foo.php',
65  'bar/foo.php',
66  ),
67  'Empty string is returned as empty string' => array(
68  '',
69  '',
70  ),
71  'Double slashes in path are removed' => array(
72  '/bar/foo.php',
73  '/bar//foo.php',
74  ),
75  'Trailing point in path is removed' => array(
76  '/foo.php',
77  './foo.php',
78  ),
79  'Point is replaced by slash' => array(
80  '/',
81  '.',
82  ),
83  './ becomes /' => array(
84  '/',
85  './',
86  )
87  );
88  }
89 
96  public function canonicalizeAndCheckFolderIdentifierCanonicalizesFolderIdentifier($expectedPath, $identifier) {
97  $this->assertSame($expectedPath, $this->subject->_callRef('canonicalizeAndCheckFolderIdentifier', $identifier));
98  }
99 
104  return array(
105  'Empty string results in slash' => array(
106  '/',
107  '',
108  ),
109  'Single point results in slash' => array(
110  '/',
111  '.',
112  ),
113  'Single slash results in single slash' => array(
114  '/',
115  '/',
116  ),
117  'Double slash results in single slash' => array(
118  '/',
119  '//',
120  ),
121  'Absolute folder paths without trailing slash gets a trailing slash' => array(
122  '/foo/',
123  '/foo',
124  ),
125  'Absolute path with trailing and leading slash is not modified' => array(
126  '/foo/',
127  '/foo/',
128  ),
129  'Relative path to folder becomes absolute path with trailing slash' => array(
130  '/foo/',
131  'foo/',
132  ),
133  );
134  }
135 
136 }
getAccessibleMockForAbstractClass( $originalClassName, array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)