adds a test for external organizer deletion
authorsstamer <s.stamer@metaways.de>
Tue, 22 Jul 2014 12:11:55 +0000 (14:11 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 25 Jul 2014 10:22:12 +0000 (12:22 +0200)
* Alarm without organizer
* improves organizer check a little bit

Change-Id: Id6d878da5df01740e723b510c109d47e5929e020
Reviewed-on: http://gerrit.tine20.com/customers/888
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Calendar/Controller/EventNotificationsTests.php
tine20/Calendar/Controller/EventNotifications.php

index 988d423..28ca194 100644 (file)
@@ -770,6 +770,37 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     }
     
     /**
+     * Trying to reproduce a fatal error but won't work yet
+     */
+    public function testAlarmWithoutOrganizer()
+    {
+        $calInstance = Addressbook_Controller_Contact::getInstance();
+        $newContactData = array(
+            'n_given'           => 'foo',
+            'n_family'          => 'PHPUNIT',
+            'email'             => 'foo@tine20.org',
+            'tel_cell_private'  => '+49TELCELLPRIVATE',
+        );
+        $newContact = $calInstance->create(new Addressbook_Model_Contact($newContactData));
+        
+        $event = $this->_getEvent();
+        $event->attendee = $this->_createAttender($newContact->getId());
+        $event->organizer = $newContact->getId();
+        
+        $event->alarms = new Tinebase_Record_RecordSet('Tinebase_Model_Alarm', array(
+            new Tinebase_Model_Alarm(array(
+                'minutes_before' => 30
+            ), TRUE)
+        ));
+        $persistentEvent = $this->_eventController->create($event);
+        
+        $calInstance->delete(array($newContact->getId()));
+        self::flushMailer();
+        Tinebase_Alarm::getInstance()->sendPendingAlarms("Tinebase_Event_Async_Minutely");
+        $this->assertEquals(0, count(self::getMessages()));
+    }
+    
+    /**
      * testRecuringAlarmAfterSeriesEnds
      * 
      * @see 0008386: alarm is sent for recur series that is already over
index 676a72b..fd39a26 100644 (file)
             // external (non account) notification
             if (!$attendeeAccountId) {
                 // external organizer needs status updates
-                $sendLevel = $organizer && $_attender->getEmail() == $organizer->getPreferedEmailAddress() ? 40 : 30;
+                $sendLevel = is_object($organizer) && $_attender->getEmail() == $organizer->getPreferedEmailAddress() ? 40 : 30;
                 $sendOnOwnActions = false;
             }