[BUGFIX] Fix tests on windows 45/60945/6
authorSusanne Moog <susanne.moog@typo3.com>
Wed, 12 Jun 2019 10:55:11 +0000 (12:55 +0200)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Mon, 17 Jun 2019 09:48:49 +0000 (11:48 +0200)
Some unit tests still have problems on Windows.
- setlocale will not error even if the locale is not found
- file permissions don't work the same as the unix style version
- absolute paths do not start with a slash
- files from finder may contain mixed slashes - generating different hash values when used as key

Tests have either been adjusted to accomodate the differing behaviour or
skipped if appropriate.

Resolves: #88552
Releases: master
Change-Id: I32344c2a0a0797db087a3ccad45d3b626715ab77
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60945
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benjamin Kott <benjamin.kott@outlook.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benjamin Kott <benjamin.kott@outlook.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/core/Tests/Unit/Configuration/ConfigurationManagerTest.php
typo3/sysext/core/Tests/Unit/Localization/LocalesTest.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/SelectViewHelperTest.php
typo3/sysext/install/Tests/Unit/UpgradeAnalysis/DocumentationFileTest.php

index 0062f61..6b5ab7f 100644 (file)
@@ -372,6 +372,7 @@ class ConfigurationManagerTest extends UnitTestCase
 
     /**
      * @test
+     * @requires OSFAMILY Linux|Darwin
      */
     public function canWriteConfigurationReturnsFalseIfLocalConfigurationFileIsNotWritable(): void
     {
index 4f044e5..ccac286 100644 (file)
@@ -115,6 +115,7 @@ class LocalesTest extends UnitTestCase
 
     /**
      * @test
+     * @requires OSFAMILY Linux|Darwin (setlocale does not check invalid locales on Windows)
      */
     public function setSystemLocaleFromSiteLanguageWithInvalidLocaleDoesNotSetLocale(): void
     {
index 45e0f8d..d8e391f 100644 (file)
@@ -1462,6 +1462,7 @@ class GeneralUtilityTest extends UnitTestCase
 
     /**
      * @test
+     * @requires OSFAMILY Linux|Darwin (path starts with a drive on Windows)
      */
     public function getIndpEnvTypo3SitePathReturnsStringStartingWithSlash()
     {
index 99df5be..d65a37b 100644 (file)
@@ -263,6 +263,7 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
 
     /**
      * @test
+     * @requires OSFAMILY Linux (bug in the C libraries on BSD/OSX | unavailable locale on Windows)
      */
     public function optionsAreSortedByLabelIfSortByOptionLabelIsSetAndLocaleEqualsUtf8()
     {
@@ -275,9 +276,6 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         } catch (Exception $e) {
             $this->markTestSkipped('Locale ' . $locale . ' is not available.');
         }
-        if (false !== stripos(PHP_OS, 'Darwin')) {
-            $this->markTestSkipped('Test skipped caused by a bug in the C libraries on BSD/OSX');
-        }
 
         $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
         $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
index 702c041..dc885a1 100644 (file)
@@ -170,8 +170,8 @@ class DocumentationFileTest extends UnitTestCase
             'Important',
         ];
         $result = $this->documentationFileService->findDocumentationFiles(vfsStream::url('root/Changelog/2.0'));
-        $key = md5('vfs://root/Changelog/2.0/Important-98574-Issue.rst');
-        self::assertEquals($expected, $result[$key]['tags']);
+        $firstResult = current($result);
+        self::assertEquals($expected, $firstResult['tags']);
     }
 
     /**