/**
  * test change pw + credential cache
  */
 public function testChangePasswordAndUpdateCredentialCache()
 {
     $this->markTestSkipped('FIXME 0009250: fix test testChangePasswordAndUpdateCredentialCache');
     $testConfig = Zend_Registry::get('testConfig');
     $account = clone $this->_account;
     unset($account->id);
     $account->type = Felamimail_Model_Account::TYPE_USER;
     $account->user = $testConfig->username;
     $imapConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::IMAP, new Tinebase_Config_Struct())->toArray();
     if (isset($imapConfig['domain']) && !empty($imapConfig['domain'])) {
         $account->user .= '@' . $imapConfig['domain'];
     }
     $account->password = $testConfig->password;
     $account = $this->_controller->create($account);
     $testPw = 'testpwd';
     // change pw & update credential cache
     $this->_setCredentials($testConfig->username, $testPw);
     $account = $this->_controller->get($account->getId());
     // try to connect to imap
     $loginSuccessful = TRUE;
     try {
         $imap = Felamimail_Backend_ImapFactory::factory($account);
     } catch (Felamimail_Exception_IMAPInvalidCredentials $e) {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' config: ' . print_r($imapAccountConfig, true) . ' / exception:' . $e);
         }
         $loginSuccessful = FALSE;
     }
     $this->assertTrue($loginSuccessful, 'wrong credentials');
 }
 /**
  * test change pw + credential cache
  */
 public function testChangePasswordAndUpdateCredentialCache()
 {
     $testConfig = Zend_Registry::get('testConfig');
     $account = clone $this->_account;
     unset($account->id);
     $account->type = Expressomail_Model_Account::TYPE_USER;
     $account->user = $testConfig->username;
     $imapConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::IMAP, new Tinebase_Config_Struct())->toArray();
     if (isset($imapConfig['domain']) && !empty($imapConfig['domain'])) {
         $account->user .= '@' . $imapConfig['domain'];
     }
     $account->password = $testConfig->password;
     $account = $this->_controller->create($account);
     $testPw = 'testpwd';
     // change pw & update credential cache
     $this->_setCredentials($testConfig->username, $testPw);
     $account = $this->_controller->get($account->getId());
     // try to connect to imap
     $loginSuccessful = TRUE;
     try {
         $imap = Expressomail_Backend_ImapFactory::factory($account);
         $imapAccountConfig = $account->getImapConfig();
         $imap->connectAndLogin((object) $imapAccountConfig);
     } catch (Expressomail_Exception_IMAPInvalidCredentials $e) {
         $loginSuccessful = FALSE;
     }
     $this->assertTrue($loginSuccessful, 'wrong credentials');
 }
 /**
  * @see 0011810: credential cache decode fails sometimes
  */
 public function testSaveAccountAndCredentialCache()
 {
     $account = new Felamimail_Model_Account(array('from' => 'Admin Account, Tine 2.0', 'port' => '143', 'smtp_port' => '25', 'smtp_ssl' => 'none', 'sieve_port' => '2000', 'sieve_ssl' => 'none', 'signature' => 'Sent with love from the Tine 2.0 email client ...<br>Please visit <a href="http://www.tine20.com">http://www.tine20.com</a>', 'sent_folder' => 'Sent', 'trash_folder' => 'Trash', 'name' => 'test', 'user' => '*****@*****.**', 'host' => 'mail.abc.de', 'email' => '*****@*****.**', 'password' => 'abcde', 'organization' => '', 'ssl' => 'none', 'display_format' => 'html', 'signature_position' => 'below', 'smtp_auth' => 'login'));
     $savedAccount = $this->_controller->create($account);
     $savedAccount->resolveCredentials();
     $this->assertEquals('*****@*****.**', $savedAccount->user);
     $this->assertEquals('abcde', $savedAccount->password);
 }