[BUGFIX] Fatal error function posix_getgroups is not available
authorPhilipp Gampe <forge.typo3.org@philippgampe.info>
Mon, 6 Feb 2012 20:10:26 +0000 (21:10 +0100)
committerJigal van Hemert <jigal@xs4all.nl>
Sat, 24 Mar 2012 09:42:16 +0000 (10:42 +0100)
This happens for the mkdirSetsGroupOwnershipOfCreatedDirectory() test in
t3lib_divTest.

Solution, just skip the test if the function does not exists.

Also do same safety check for posix_getegid() as done some tests above.

Change-Id: I18cbebc0b22ae5a7318673ed8abd2bd01003ba57
Fixes: #33718
Releases: 6.0, 4.7
Reviewed-on: http://review.typo3.org/8867
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
tests/t3lib/class.t3lib_divTest.php

index baeb90b..882a3b5 100644 (file)
@@ -2536,6 +2536,14 @@ class t3lib_divTest extends tx_phpunit_testcase {
         * @test
         */
        public function mkdirSetsGroupOwnershipOfCreatedDirectory() {
         * @test
         */
        public function mkdirSetsGroupOwnershipOfCreatedDirectory() {
+               if (!function_exists('posix_getegid')) {
+                       $this->markTestSkipped('Function posix_getegid() not available, mkdirSetsGroupOwnershipOfCreatedDirectory() tests skipped');
+               }
+               if (posix_getegid() === -1) {
+                       $this->markTestSkipped(
+                               'The mkdirSetsGroupOwnershipOfCreatedDirectory() is not available on Mac OS because posix_getegid() always returns -1 on Mac OS.'
+                       );
+               }
                $swapGroup = $this->checkGroups(__FUNCTION__);
                if ($swapGroup !== FALSE) {
                        $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup'] = $swapGroup;
                $swapGroup = $this->checkGroups(__FUNCTION__);
                if ($swapGroup !== FALSE) {
                        $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup'] = $swapGroup;
@@ -2564,6 +2572,9 @@ class t3lib_divTest extends tx_phpunit_testcase {
                        $this->markTestSkipped($methodName . '() test not available on Windows.');
                        return FALSE;
                }
                        $this->markTestSkipped($methodName . '() test not available on Windows.');
                        return FALSE;
                }
+               if (!function_exists('posix_getgroups')) {
+                       $this->markTestSkipped('Function posix_getgroups() not available, ' . $methodName . '() tests skipped');
+               }
 
                $groups = posix_getgroups();
                if (count($groups) <= 1) {
 
                $groups = posix_getgroups();
                if (count($groups) <= 1) {