Merge branch '2013.10' into 2014.11
[tine20] / tests / tine20 / TestCase.php
index 59efe10..cfaa915 100644 (file)
@@ -106,8 +106,10 @@ abstract class TestCase extends PHPUnit_Framework_TestCase
         }
         
         Addressbook_Controller_Contact::getInstance()->setGeoDataForContacts(true);
-        
-        Tinebase_Core::set(Tinebase_Core::USER, $this->_originalTestUser);
+
+        if ($this->_originalTestUser instanceof Tinebase_Model_User) {
+            Tinebase_Core::set(Tinebase_Core::USER, $this->_originalTestUser);
+        }
         
         Tinebase_Cache_PerRequest::getInstance()->resetCache();
     }
@@ -189,12 +191,17 @@ abstract class TestCase extends PHPUnit_Framework_TestCase
      */
     protected function _deleteUsers()
     {
+
+
         foreach ($this->_usernamesToDelete as $username) {
             try {
+                if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
+                    . ' Trying to delete user: ' . $username);
+
                 Tinebase_User::getInstance()->deleteUser(Tinebase_User::getInstance()->getUserByLoginName($username));
             } catch (Exception $e) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
-                    . ' error while deleting user: ' . $e->getMessage());
+                    . ' Error while deleting user: ' . $e->getMessage());
             }
         }
     }