コード例 #1
0
 /**
  * sieve test helper
  *
  * @param array $_sieveData
  * @return array
  */
 protected function _sieveTestHelper($_sieveData, $_isMime = FALSE)
 {
     $this->_setTestScriptname();
     // check which save fn to use
     if (isset($_sieveData['reason']) || array_key_exists('reason', $_sieveData)) {
         $resultSet = $this->_json->saveVacation($_sieveData);
         $this->assertEquals($this->_account->email, $resultSet['addresses'][0]);
         $_sieveBackend = Felamimail_Backend_SieveFactory::factory($this->_account->getId());
         if (preg_match('/dbmail/i', $_sieveBackend->getImplementation())) {
             $translate = Tinebase_Translation::getTranslation('Felamimail');
             $this->assertEquals(sprintf($translate->_('Out of Office reply from %1$s'), Tinebase_Core::getUser()->accountFullName), $resultSet['subject']);
         } else {
             $this->assertEquals($_sieveData['subject'], $resultSet['subject']);
         }
         if ($_isMime) {
             $this->assertEquals(html_entity_decode('unittest vacation message', ENT_NOQUOTES, 'UTF-8'), $resultSet['reason']);
         } else {
             $this->assertEquals($_sieveData['reason'], $resultSet['reason']);
         }
     } else {
         if (isset($_sieveData[0]['action_type']) || array_key_exists('action_type', $_sieveData[0])) {
             $resultSet = $this->_json->saveRules($this->_account->getId(), $_sieveData);
             $this->assertEquals($_sieveData, $resultSet);
         }
     }
     return $resultSet;
 }