[TASK] Switch some skipped conditions to annotations in GeneralUtilityTest 02/57802/5
authorJohannes Seipelt <johannes.seipelt@3m5.de>
Fri, 3 Aug 2018 17:05:16 +0000 (19:05 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 4 Aug 2018 10:23:59 +0000 (12:23 +0200)
Set requirements for some tests by annotation instead of conditions.

Resolves: #85747
Releases: master
Change-Id: Ic1c72bcf9757d2f6d0bb2294b445248479db9dd3
Reviewed-on: https://review.typo3.org/57802
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php

index 0b5addc..6cfe978 100644 (file)
@@ -1513,12 +1513,10 @@ class GeneralUtilityTest extends UnitTestCase
 
     /**
      * @test
+     * @requires OSFAMILY Windows
      */
     public function getIndpEnvTypo3SitePathReturnsStringStartingWithDrive()
     {
-        if (!Environment::isWindows()) {
-            $this->markTestSkipped('Test available only on Windows OS.');
-        }
         $result = GeneralUtility::getIndpEnv('TYPO3_SITE_PATH');
         $this->assertRegExp('/^[a-z]:\//i', $result);
     }
@@ -2514,15 +2512,13 @@ class GeneralUtilityTest extends UnitTestCase
     ///////////////////////////////
     /**
      * @test
+     * @requires function posix_getegid
      */
     public function fixPermissionsSetsGroup()
     {
         if (Environment::isWindows()) {
             $this->markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
-        if (!function_exists('posix_getegid')) {
-            $this->markTestSkipped('Function posix_getegid() not available, fixPermissionsSetsGroup() tests skipped');
-        }
         if (posix_getegid() === -1) {
             $this->markTestSkipped('The fixPermissionsSetsGroup() is not available on Mac OS because posix_getegid() always returns -1 on Mac OS.');
         }
@@ -2844,6 +2840,8 @@ class GeneralUtilityTest extends UnitTestCase
      *
      * @param string $methodName calling method name
      * @return mixed FALSE if test cannot be run, int group id of the second group of webserver user
+     * @requires function posix_getegid
+     * @requires function posix_getgroups
      */
     private function checkGroups($methodName)
     {
@@ -2851,18 +2849,10 @@ class GeneralUtilityTest extends UnitTestCase
             $this->markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
             return false;
         }
-        if (!function_exists('posix_getegid')) {
-            $this->markTestSkipped('Function posix_getegid() not available, ' . $methodName . '() tests skipped');
-            return false;
-        }
         if (posix_getegid() === -1) {
             $this->markTestSkipped('Function posix_getegid() returns -1, ' . $methodName . '() tests skipped');
             return false;
         }
-        if (!function_exists('posix_getgroups')) {
-            $this->markTestSkipped('Function posix_getgroups() not available, ' . $methodName . '() tests skipped');
-            return false;
-        }
         $groups = posix_getgroups();
         if (count($groups) <= 1) {
             $this->markTestSkipped($methodName . '() test cannot be done when the web server user is only member of 1 group.');