/**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->_backend = new Tasks_Frontend_Json();
     $this->_smtpConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::SMTP, new Tinebase_Config_Struct())->toArray();
     $this->_smtpTransport = Tinebase_Smtp::getDefaultTransport();
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  */
 public function setUp()
 {
     $smtpConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::SMTP, new Tinebase_Config_Struct())->toArray();
     if (empty($smtpConfig)) {
         $this->markTestSkipped('No SMTP config found: this is needed to send notifications.');
     }
     $this->_mailer = Tinebase_Smtp::getDefaultTransport();
 }
 /**
  * get mailer
  * 
  * @return Zend_Mail_Transport_Abstract
  */
 public static function getMailer()
 {
     if (!self::$_mailer) {
         self::$_mailer = Tinebase_Smtp::getDefaultTransport();
     }
     return self::$_mailer;
 }
 /**
  * testContainerNotification
  */
 public function testContainerNotification()
 {
     // prepare smtp transport
     $smtpConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::SMTP, new Tinebase_Config_Struct())->toArray();
     if (empty($smtpConfig)) {
         $this->markTestSkipped('No SMTP config found: this is needed to send notifications.');
     }
     $mailer = Tinebase_Smtp::getDefaultTransport();
     // make sure all messages are sent if queue is activated
     if (isset(Tinebase_Core::getConfig()->actionqueue)) {
         Tinebase_ActionQueue::getInstance()->processQueue(100);
     }
     $mailer->flush();
     // create and update container
     $container = $this->_saveContainer();
     $container['type'] = Tinebase_Model_Container::TYPE_PERSONAL;
     $container['note'] = 'changed to personal';
     $container['account_grants'] = $this->_getContainerGrants();
     $containerUpdated = $this->_json->saveContainer($container);
     // make sure messages are sent if queue is activated
     if (isset(Tinebase_Core::getConfig()->actionqueue)) {
         Tinebase_ActionQueue::getInstance()->processQueue();
     }
     // check notification message
     $messages = $mailer->getMessages();
     $this->assertGreaterThan(0, count($messages));
     $notification = $messages[0];
     $translate = Tinebase_Translation::getTranslation('Admin');
     $body = quoted_printable_decode($notification->getBodyText(TRUE));
     $this->assertContains($container['note'], $body, $body);
     $subject = $notification->getSubject();
     if (strpos($subject, 'UTF-8') !== FALSE) {
         $this->assertEquals(iconv_mime_encode('Subject', $translate->_('Your container has been changed'), array('scheme' => 'Q', 'line-length' => 500)), 'Subject: ' . $subject);
     } else {
         $this->assertEquals($translate->_('Your container has been changed'), $subject);
     }
     $this->assertTrue(in_array(Tinebase_Core::getUser()->accountEmailAddress, $notification->getRecipients()));
 }
 /**
  * testInternalInvitationReplyAutoProcess
  * 
  * an internal reply does not need to be processed of course
  */
 public function testInternalInvitationReplyAutoProcess()
 {
     // flush mailer
     if (isset(Tinebase_Core::getConfig()->actionqueue)) {
         Tinebase_ActionQueue::getInstance()->processQueue(10000);
     }
     Tinebase_Smtp::getDefaultTransport()->flush();
     $iMIP = $this->_getiMIP('REPLY', TRUE);
     $event = $iMIP->getEvent();
     try {
         $this->_iMIPFrontend->autoProcess($iMIP);
     } catch (Exception $e) {
         $this->assertContains('TOPROCESS', $e->getMessage());
         return;
     }
     $this->fail("autoProcess did not throw TOPROCESS Exception {$e}");
 }
Esempio n. 6
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->_backend = new Tasks_Frontend_Json();
     $this->_smtpConfig = Tinebase_Config::getInstance()->getConfigAsArray(Tinebase_Config::SMTP);
     $this->_smtpTransport = Tinebase_Smtp::getDefaultTransport();
 }