only assert organizer reply if notification backend is configured
[tine20] / tests / tine20 / Calendar / Frontend / iMIPTest.php
index 02048fe..a260684 100644 (file)
@@ -307,12 +307,16 @@ class Calendar_Frontend_iMIPTest extends TestCase
         $this->assertEquals(Calendar_Model_Attender::STATUS_ACCEPTED, $ownAttendee->status, 'must be ACCEPTED');
         
         // assert REPLY message to organizer only
-        $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');
-        $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');
+        $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))) {
+            $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');
+            $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');
+        }
     }
     
     /**