[BUGFIX] Skip t3lib_divTest::fixPermissionsSetsGroup on MacOS
authorOliver Klee <typo3-coding@oliverklee.de>
Sat, 9 Jul 2011 09:02:21 +0000 (11:02 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Sun, 11 Mar 2012 17:02:18 +0000 (18:02 +0100)
This test makes use of posix_getegid which on Mac OS always returns -1,
thus making it useless for getting the effective group ID.

Change-Id: I5a1cc6ceb8613aa4186c99f06e696668f3e9dde4
Resolves: #28017
Releases: 4.6, 4.5, 4.4, 4.3
Reviewed-on: http://review.typo3.org/7125
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
tests/t3lib/t3lib_divTest.php

index 0299b72..444d1c7 100644 (file)
@@ -1975,25 +1975,32 @@ class t3lib_divTest extends tx_phpunit_testcase {
         */
        public function fixPermissionsCorrectlySetsGroup() {
                if (TYPO3_OS == 'WIN') {
-                       $this->markTestSkipped('fixPermissionsCorrectlySetsGroupOwnerOfFile() tests not available on Windows');
+                       $this->markTestSkipped('fixPermissionsSetsGroup() tests not available on Windows');
                }
                if (!function_exists('posix_getegid')) {
-                       $this->markTestSkipped('Function posix_getegid() not available, fixPermissionsCorrectlySetsGroupOwnerOfFile() tests skipped');
+                       $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.'
+                       );
                }
 
                        // Create and prepare test file
                $filename = PATH_site . 'typo3temp/' . uniqid('test_');
                t3lib_div::writeFileToTypo3tempDir($filename, '42');
 
+               $currentGroupId = posix_getegid();
+
                        // Set target group and run method
-               $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup'] = posix_getegid();
+               $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup'] = $currentGroupId;
                $fixPermissionsResult = t3lib_div::fixPermissions($filename);
 
                clearstatcache();
                $resultFileGroup = filegroup($filename);
                unlink($filename);
 
-               $this->assertEquals($resultFileGroup, posix_getegid());
+               $this->assertEquals($resultFileGroup, $currentGroupId);
        }
 
        /**