do not try to loop non-array in TestCase group cleanup
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 10 Mar 2016 09:06:00 +0000 (10:06 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 10 Mar 2016 10:46:58 +0000 (11:46 +0100)
LDAP tests:
Invalid argument supplied for foreach()

/usr/local/share/tine20.git/tests/tine20/TestCase.php:209
/usr/local/share/tine20.git/tests/tine20/TestCase.php:114
/usr/local/share/tine20.git/tests/tine20/Addressbook/JsonTest.php:150

Change-Id: I3f5b63f95da4741c8ed9a70e65659a0f1ccd7549
Reviewed-on: http://gerrit.tine20.com/customers/2875
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/TestCase.php

index 7ffba34..1400a7f 100644 (file)
@@ -206,6 +206,10 @@ abstract class TestCase extends PHPUnit_Framework_TestCase
      */
     protected function _deleteGroups()
     {
+        if (! is_array($this->_groupIdsToDelete)) {
+            return;
+        }
+
         foreach ($this->_groupIdsToDelete as $groupId) {
             if ($this->_removeGroupMembers) {
                 foreach (Tinebase_Group::getInstance()->getGroupMembers($groupId) as $userId) {