/**
  * test send deactivation notification
  * 
  * @see 0009956: send mail on account deactivation
  */
 public function testAccountDeactivationNotification()
 {
     $smtpConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::SMTP);
     if (!isset($smtpConfig->from) && !isset($smtpConfig->primarydomain)) {
         $this->markTestSkipped('no notification service address configured.');
     }
     Tinebase_Config::getInstance()->set(Tinebase_Config::ACCOUNT_DEACTIVATION_NOTIFICATION, true);
     $userArray = $this->testSaveAccount();
     self::flushMailer();
     $this->_json->setAccountState(array($userArray['accountId']), 'disabled');
     $messages = self::getMessages();
     $this->assertEquals(1, count($messages), 'did not get notification message');
     $message = $messages[0];
     $bodyText = $message->getBodyText(true);
     $translate = Tinebase_Translation::getTranslation('Tinebase');
     $this->assertEquals($translate->_('Your Tine 2.0 account has been deactivated'), $message->getSubject());
     // @todo make this work. currently it does not work in de translation as the user name is cropped (tine20phpuni=)
     //$this->assertContains($userArray['accountLoginName'], $bodyText);
     $this->assertContains(Tinebase_Core::getHostname(), $bodyText);
 }
示例#2
0
 /**
  * try to set account state
  *
  */
 public function testSetAccountState()
 {
     $this->_json->setAccountState(array($this->objects['user']->getId()), 'disabled');
     $account = Tinebase_User::getInstance()->getFullUserById($this->objects['user']);
     $this->assertEquals('disabled', $account->accountStatus);
 }