/**
  * testExternalInvitationRequestProcess
  */
 public function testExternalInvitationRequestProcess()
 {
     $ics = Calendar_Frontend_WebDAV_EventTest::getVCalendar(dirname(__FILE__) . '/files/invitation_request_external.ics');
     $ics = preg_replace('#DTSTART;VALUE=DATE-TIME;TZID=Europe/Berlin:20111121T130000#', 'DTSTART;VALUE=DATE-TIME;TZID=Europe/Berlin:' . Tinebase_DateTime::now()->addHour(1)->format('Ymd\\THis'), $ics);
     $ics = preg_replace('#DTEND;VALUE=DATE-TIME;TZID=Europe/Berlin:20111121T140000#', 'DTEND;VALUE=DATE-TIME;TZID=Europe/Berlin:' . Tinebase_DateTime::now()->addHour(2)->format('Ymd\\THis'), $ics);
     $iMIP = new Calendar_Model_iMIP(array('id' => Tinebase_Record_Abstract::generateUID(), 'ics' => $ics, 'method' => 'REQUEST', 'originator' => '*****@*****.**'));
     Calendar_Controller_EventNotificationsTests::flushMailer();
     $result = $this->_iMIPFrontendMock->process($iMIP, Calendar_Model_Attender::STATUS_ACCEPTED);
     $this->_iMIPFrontend->prepareComponent($iMIP);
     $this->_eventIdsToDelete[] = $iMIP->event->getId();
     // assert external organizer
     $this->assertEquals('*****@*****.**', $iMIP->event->organizer->email, 'wrong organizer');
     $this->assertTrue(empty($iMIP->event->organizer->account_id), 'organizer must not have an account');
     // assert attendee
     $ownAttendee = Calendar_Model_Attender::getOwnAttender($iMIP->event->attendee);
     $this->assertTrue(!!$ownAttendee, 'own attendee missing');
     $this->assertEquals(5, count($iMIP->event->attendee), 'all attendee must be keeped');
     $this->assertEquals(Calendar_Model_Attender::STATUS_ACCEPTED, $ownAttendee->status, 'must be ACCEPTED');
     // assert no status authkey for external attendee
     foreach ($iMIP->event->attendee as $attendee) {
         if (!$attendee->user_id->account_id) {
             $this->assertFalse(!!$attendee->user_id->status_authkey, 'authkey should be skipped');
         }
     }
     // assert REPLY message to organizer only
     $smtpConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::SMTP);
     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('*****@*****.**', $messages[0]->getRecipients()), 'organizer is not a receipient');
         $this->assertContains('accepted', $messages[0]->getSubject(), 'wrong subject');
         $this->assertContains('METHOD:REPLY', var_export($messages[0], TRUE), 'method missing');
         $this->assertContains('SEQUENCE:0', var_export($messages[0], TRUE), 'external sequence has not been keepted');
     }
 }
 /**
  * put an exception event created by "remind" option of alarm in iCal
  */
 public function testPutEventExceptionAlarmReminder()
 {
     $event = $this->_createRecurringCalDavEvent();
     $messages = self::getMessages();
     $this->assertEquals(1, count($messages), 'one invitation should be send to sclever');
     $this->_assertMail('sclever', 'invitation');
     // create alarm reminder/snooze exception
     Calendar_Controller_EventNotificationsTests::flushMailer();
     $vcalendar = Calendar_Frontend_WebDAV_EventTest::getVCalendar(dirname(__FILE__) . '/../Import/files/apple_ical_remind_part2.ics');
     $event->put($vcalendar);
     // assert no reschedule mail
     $messages = Calendar_Controller_EventNotificationsTests::getMessages();
     $this->assertEquals(0, count($messages), 'no reschedule mails should be send for implicit exception');
 }
Example #3
0
 /**
  * testExternalInvitationRequestProcess
  * - uses felamimail to cache external invitation message
  * 
  * -> external invitation requests are not supported atm
  */
 public function testExternalInvitationRequestProcess()
 {
     $this->_checkIMAPConfig();
     $testConfig = Zend_Registry::get('testConfig');
     $email = $testConfig->email ? $testConfig->email : '*****@*****.**';
     // handle message with fmail (add to cache)
     $message = $this->_emailTestClass->messageTestHelper('calendar_request.eml', NULL, NULL, array('*****@*****.**', $email));
     $complete = Felamimail_Controller_Message::getInstance()->getCompleteMessage($message);
     $iMIP = $complete->preparedParts->getFirstRecord()->preparedData;
     Calendar_Controller_EventNotificationsTests::flushMailer();
     $result = $this->_iMIPFrontend->process($iMIP, Calendar_Model_Attender::STATUS_ACCEPTED);
     $this->_iMIPFrontend->prepareComponent($iMIP);
     $this->_eventIdsToDelete[] = $iMIP->event->getId();
     // assert external organizer
     $this->assertEquals('*****@*****.**', $iMIP->event->organizer->email, 'wrong organizer');
     $this->assertTrue(empty($iMIP->event->organizer->account_id), 'organizer must not have an account');
     // assert attendee
     $this->assertEquals(1, count($iMIP->event->attendee), 'all attendee but curruser must be whiped');
     $this->assertEquals($email, $iMIP->event->attendee->getFirstRecord()->user_id->email, 'wrong attendee mail');
     $this->assertEquals(Tinebase_Core::getUser()->getId(), $iMIP->event->attendee->getFirstRecord()->user_id->account_id, 'wrong attendee');
     $this->assertEquals(Calendar_Model_Attender::STATUS_ACCEPTED, $iMIP->event->attendee->getFirstRecord()->status);
     // assert REPLY message
     $messages = Calendar_Controller_EventNotificationsTests::getMessages();
     $this->assertEquals(1, count($messages), 'only one mails should be send');
     $this->assertTrue(in_array('*****@*****.**', $messages[0]->getRecipients()), 'organizer is not a receipient');
     $this->assertContains('METHOD:REPLY', var_export($messages[0], TRUE), 'method missing');
 }