Merge branch 'pu/2013.10-caldav' into 2014.09
[tine20] / tests / tine20 / Calendar / Frontend / iMIPTest.php
index db395cc..4a372bd 100644 (file)
@@ -311,8 +311,7 @@ class Calendar_Frontend_iMIPTest extends TestCase
         
         // assert REPLY message to organizer only
         $smtpConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::SMTP);
-        $mailer = Calendar_Controller_EventNotificationsTests::getMailer();
-        if ($mailer instanceof Zend_Mail_Transport_Array || (isset($smtpConfig->from) && ! empty($smtpConfig->from))) {
+        if (isset($smtpConfig->from) && ! empty($smtpConfig->from)) {
             $messages = Calendar_Controller_EventNotificationsTests::getMessages();
             $this->assertEquals(1, count($messages), 'exactly one mail should be send');
             $this->assertTrue(in_array('l.kneschke@caldav.org', $messages[0]->getRecipients()), 'organizer is not a receipient');
@@ -502,7 +501,7 @@ class Calendar_Frontend_iMIPTest extends TestCase
         
         $this->assertEquals(3, count($updatedEvent->attendee));
         $this->assertEquals(Calendar_Model_Attender::STATUS_ACCEPTED, $updatedExternalAttendee->status, 'status not updated');
-    
+        
         // TEST ACCEPTABLE NON RECENT REPLY
         $updatedExternalAttendee->status = Calendar_Model_Attender::STATUS_NEEDSACTION;
         Calendar_Controller_Event::getInstance()->attenderStatusUpdate($updatedEvent, $updatedExternalAttendee, $updatedExternalAttendee->status_authkey);
@@ -519,11 +518,20 @@ class Calendar_Frontend_iMIPTest extends TestCase
         
         $this->assertEquals(3, count($updatedEvent->attendee));
         $this->assertEquals(Calendar_Model_Attender::STATUS_ACCEPTED, $updatedExternalAttendee->status, 'status not updated');
-    
+        
+        // check if attendee are resolved
+        $existingEvent = $iMIP->getExistingEvent();
+        $this->assertTrue($iMIP->existing_event->attendee instanceof Tinebase_Record_RecordSet);
+        $this->assertEquals(3, count($iMIP->existing_event->attendee));
+        
         // TEST NON ACCEPTABLE NON RECENT REPLY
-        $this->setExpectedException('Calendar_Exception_iMIP', 'iMIP preconditions failed: RECENT');
         $iMIP->preconditionsChecked = false;
-        $this->_iMIPFrontend->autoProcess($iMIP);
+        try {
+            $this->_iMIPFrontend->autoProcess($iMIP);
+            $this->fail('autoProcess should throw Calendar_Exception_iMIP');
+        } catch (Calendar_Exception_iMIP $cei) {
+            $this->assertContains('iMIP preconditions failed: RECENT', $cei->getMessage());
+        }
     }
 
     /**