Go to the documentation of this file.
2 declare(strict_types = 1);
20 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
42 $this->assertEquals($expected, $commonPrefix);
53 '/var/www/myhost.com/t3lib/'
55 '/var/www/myhost.com/t3lib/'
59 '/var/www/myhost.com/t3lib/',
60 '/var/www/myhost.com/t3lib/'
62 '/var/www/myhost.com/t3lib/'
66 '/var/www/myhost.com/typo3/',
67 '/var/www/myhost.com/t3lib/'
69 '/var/www/myhost.com/'
73 '/var/www/myhost.com/typo3/',
74 '/var/www/myhost.com/typo3'
76 '/var/www/myhost.com/typo3/'
80 '/var/www/myhost.com/typo3',
81 '/var/www/myhost.com/typo3'
83 '/var/www/myhost.com/typo3/'
87 '/var/www/myhost.com/uploads/',
88 '/var/www/myhost.com/typo3/',
89 '/var/www/myhost.com/t3lib/'
91 '/var/www/myhost.com/'
95 '/var/www/myhost.com/uploads/directory/',
96 '/var/www/myhost.com/typo3/sysext/',
97 '/var/www/myhost.com/t3lib/utility/'
99 '/var/www/myhost.com/'
103 'C:\\www\\myhost.com\\t3lib\\'
105 'C:/www/myhost.com/t3lib/'
109 'C:\\www\\myhost.com\\t3lib\\',
110 'C:\\www\\myhost.com\\t3lib\\'
112 'C:/www/myhost.com/t3lib/'
116 'C:\\www\\myhost.com\\typo3\\',
117 'C:\\www\\myhost.com\\t3lib\\'
123 'C:\\www\\myhost.com\\uploads\\',
124 'C:\\www\\myhost.com\\typo3\\',
125 'C:\\www\\myhost.com\\t3lib\\'
131 'C:\\www\\myhost.com\\uploads\\directory\\',
132 'C:\\www\\myhost.com\\typo3\\sysext\\',
133 'C:\\www\\myhost.com\\t3lib\\utility\\'
150 $this->assertEquals($expected, $relativePath);
187 '../../../t3lib/utility/'
202 $this->assertEquals($expected, $sanitizedPath);
211 [
'/var/www//',
'/',
'/var/www/'],
212 [
'/var/www/',
'/',
'/var/www/'],
213 [
'/var/www',
'/',
'/var/www/']
235 'preserve relative path if path goes above start path' => [
240 'preserve absolute path even if path goes above start path' => [
245 'base folder with same folder path' => [
250 'base folder with parent folder path' => [
268 $this->assertEquals($expectedFileName, $resolvedFilename);
279 'removes single-dot-elements' => [
283 'removes ./ at beginning' => [
287 'removes double-slashes' => [
291 'removes double-slashes from front, but keeps absolute path' => [
295 'makes double-dot-elements go one level higher, test #1' => [
299 'makes double-dot-elements go one level higher, test #2' => [
300 'abc/def/ghi/../123/456/..',
303 'makes double-dot-elements go one level higher, test #3' => [
307 'makes double-dot-elements go one level higher, test #4' => [
308 'abc/def/ghi//../123/456/..',
311 'truncates slash at the end' => [
315 'keeps slash in front of absolute paths' => [
319 'keeps slash in front of absolute paths even if double-dot-elements want to go higher' => [
320 '/abc/../../def/ghi',
323 'works with EXT-syntax-paths' => [
327 'truncates ending slash with space' => [
331 'truncates ending space' => [
335 'truncates ending dot' => [
339 'does not truncates ending dot if part of name' => [
343 'protocol is not removed' => [
344 'vfs://def/../text.txt',
347 'works with filenames' => [
351 'absolute windwos path' => [
352 'C:\def\..\..\test.txt',
355 'double slashaes' => [
359 'multiple slashes' => [
404 'absolute path 1' => [
405 '/var/www/html/index.php',
408 'absolute path 2' => [
409 '/var/www/html/typo3/index.php',
410 '/var/www/html/typo3'
413 'C:\\inetpub\\index.php',
445 'absolute path 1' => [
446 '/var/www/html/index.php',
449 'absolute path 2' => [
450 '/var/www/html/typo3/index.php',
454 'C:\\inetpub\\index.php',
482 'starting slash' => [
487 'starting slash on windows' => [
497 'no match on windows' => [
502 'path starts with C:/' => [
507 'path starts with C:/ on windows' => [
512 'path starts with C:\\' => [
517 'path starts with C:\\ on windows' => [
static string basenameDuringBootstrap($path)
dirnameDuringBootstrapCorrectlyFetchesParent(string $inputPath, string $expectedResult)
static string getPublicPath()
isTrailingSeparatorSanitizedCorrectly($path, $separator, $expected)
static string null getRelativePath($sourcePath, $targetPath)
static string dirnameDuringBootstrap($path)
static string getCurrentScript()
string[][] getCanonicalPathCorrectlyCleansPathDataProvider()
static string getCanonicalPath($path)
array[] isAbsolutePathRespectsAllOperatingSystemsPathDataProvider()
isAbsolutePathRespectsAllOperatingSystems(string $inputPath, bool $isWindows, bool $expectedResult)
static ApplicationContext getContext()
getAbsolutePathOfRelativeReferencedFileOrPathResolvesFileCorrectly($baseFileName, $includeFileName, $expectedFileName)
static string getProjectPath()
basenameDuringBootstrapCorrectlyFetchesBasename(string $inputPath, string $expectedResult)
string[][] dirnameDuringBootstrapCorrectlyFetchesParentDataProvider()
array getAbsolutePathOfRelativeReferencedFileOrPathResolvesFileCorrectlyDataProvider()
static string null getCommonPrefix(array $paths)
isRelativePathResolvedCorrectly($source, $target, $expected)
array isCommonPrefixResolvedCorrectlyDataProvider()
array isRelativePathResolvedCorrectlyDataProvider()
static initialize(ApplicationContext $context, bool $cli, bool $composerMode, string $projectPath, string $publicPath, string $varPath, string $configPath, string $currentScript, string $os)
array basenameDuringBootstrapCorrectlyFetchesBasenameDataProvider()
static bool isAbsolutePath($path)
array isTrailingSeparatorSanitizedCorrectlyDataProvider()
static string sanitizeTrailingSeparator($path, $separator='/')
static string getConfigPath()
isCommonPrefixResolvedCorrectly(array $paths, $expected)
static string getAbsolutePathOfRelativeReferencedFileOrPath($baseFilenameOrPath, $includeFileName)
getCanonicalPathCorrectlyCleansPath(string $inputName, string $expectedResult)
static string getVarPath()