From 991fba3f655a77f677decd8964f3683a3b1b8d96 Mon Sep 17 00:00:00 2001
From: Tymoteusz Motylewski <t.motylewski@gmail.com>
Date: Fri, 7 Apr 2023 23:46:39 +0200
Subject: [PATCH] [TASK] Improve PathUtility tests

Add more test cases found when running mutation tests.


Resolves: #100532
Releases: master, 11.5
Change-Id: I3dc61e303351d4f63b4b4ad757f21188f1e60117
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78552
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 typo3/sysext/core/Tests/Unit/Utility/PathUtilityTest.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/typo3/sysext/core/Tests/Unit/Utility/PathUtilityTest.php b/typo3/sysext/core/Tests/Unit/Utility/PathUtilityTest.php
index b0c99185bca5..5ad431fdcfa9 100644
--- a/typo3/sysext/core/Tests/Unit/Utility/PathUtilityTest.php
+++ b/typo3/sysext/core/Tests/Unit/Utility/PathUtilityTest.php
@@ -320,6 +320,10 @@ class PathUtilityTest extends UnitTestCase
                 '/abc/../../def/ghi',
                 '/def/ghi',
             ],
+            'double-dot-elements want to go higher, more than one segment' => [
+                '/abc/../../../../def/ghi',
+                '/def/ghi',
+            ],
             'works with EXT-syntax-paths' => [
                 'EXT:abc/def/ghi/',
                 'EXT:abc/def/ghi',
@@ -352,6 +356,10 @@ class PathUtilityTest extends UnitTestCase
                 'C:\def\..\..\test.txt',
                 'C:/test.txt',
             ],
+            'absolute windows path with more segments' => [
+                'C:\def\def2\def3\..\..\folder\subfolder\test.txt',
+                'C:/def/folder/subfolder/test.txt',
+            ],
             'double slashaes' => [
                 'abc//def',
                 'abc/def',
-- 
GitLab