[BUGFIX] Prevent temp file generation in Unit Test 32/48032/2
authorNicole Cordes <typo3@cordes.co>
Fri, 6 May 2016 17:10:55 +0000 (19:10 +0200)
committerNicole Cordes <typo3@cordes.co>
Sat, 7 May 2016 09:01:50 +0000 (11:01 +0200)
Running Unit Tests creates file /tmp/typo3.log. On Windows systems
this file is stored on the root of the drive. This patch uses the
defined temp folder for storing the file.

Resolves: #76070
Releases: master, 7.6, 6.2
Change-Id: Id77684e41020feb1a1ecff5051a80d2919250bf8
Reviewed-on: https://review.typo3.org/48032
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/core/Tests/Unit/Log/Writer/FileWriterTest.php

index 6a0dfef..456d553 100644 (file)
@@ -96,8 +96,9 @@ class FileWriterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function setLogFileAcceptsAbsolutePath()
     {
         $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\Writer\FileWriter::class);
-        $writer->setLogFile('/tmp/typo3.log');
-        $this->assertAttributeEquals('/tmp/typo3.log', 'logFile', $writer);
+        $tempFile = rtrim(sys_get_temp_dir(), '/\\') . '/typo3.log';
+        $writer->setLogFile($tempFile);
+        $this->assertAttributeEquals($tempFile, 'logFile', $writer);
     }
 
     /**