[BUGFIX] Ensure unix like paths for temp files
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Utility / GeneralUtilityTest.php
index 15a2272..137df69 100644 (file)
@@ -2132,6 +2132,35 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        }
 
        //////////////////////////////////////
+       // Tests concerning tempnam
+       //////////////////////////////////////
+
+       /**
+        * @test
+        */
+       public function tempnamReturnsPathStartingWithGivenPrefix() {
+               $filePath = Utility\GeneralUtility::tempnam('foo');
+               $fileName = basename($filePath);
+               $this->assertStringStartsWith('foo', $fileName);
+       }
+
+       /**
+        * @test
+        */
+       public function tempnamReturnsPathWithoutBackslashes() {
+               $filePath = Utility\GeneralUtility::tempnam('foo');
+               $this->assertNotContains('\\', $filePath);
+       }
+
+       /**
+        * @test
+        */
+       public function tempnamReturnsAbsolutePathInsideDocumentRoot() {
+               $filePath = Utility\GeneralUtility::tempnam('foo');
+               $this->assertStringStartsWith(PATH_site, $filePath);
+       }
+
+       //////////////////////////////////////
        // Tests concerning addSlashesOnArray
        //////////////////////////////////////
        /**