9578: Cli Ex / Import Calendar doesn't work
[tine20] / tests / tine20 / Calendar / TestCase.php
index ebef856..3260027 100644 (file)
@@ -104,18 +104,20 @@ abstract class Calendar_TestCase extends TestCase
         
         Calendar_Controller_Event::getInstance()->sendNotifications(false);
         
+        
         if (! $this->_transactionId) {
-            $events = $this->_backend->search(new Calendar_Model_EventFilter(array(
-                array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_testCalendars->getId()),
-            )), new Tinebase_Model_Pagination(array()));
-            
-            // delete alarms
-            Tinebase_Alarm::getInstance()->deleteAlarmsOfRecord('Calendar_Model_Event', $events->getArrayOfIds());
-            
-            foreach ($events as $event) {
-                $this->_backend->delete($event->getId());
+            if ($this->_backend != NULL) {
+                $events = $this->_backend->search(new Calendar_Model_EventFilter(array(
+                    array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_testCalendars->getId()),
+                )), new Tinebase_Model_Pagination(array()));
+                
+                // delete alarms
+                Tinebase_Alarm::getInstance()->deleteAlarmsOfRecord('Calendar_Model_Event', $events->getArrayOfIds());
+                
+                foreach ($events as $event) {
+                    $this->_backend->delete($event->getId());
+                }
             }
-            
             foreach ($this->_testCalendars as $cal) {
                 Tinebase_Container::getInstance()->deleteContainer($cal, true);
             }
@@ -125,6 +127,7 @@ abstract class Calendar_TestCase extends TestCase
             // reset test user
             Tinebase_Core::set(Tinebase_Core::USER, $this->_testUser);
         }
+        
     }
     
     /**