adding database entity MailAccount and it's mapper
This commit is contained in:
Родитель
3d885319ef
Коммит
bc20a044d3
|
@ -0,0 +1,276 @@
|
|||
<?php
|
||||
/**
|
||||
* ownCloud - Mail app
|
||||
*
|
||||
* @author Sebastian Schmid
|
||||
* @copyright 2013 Sebastian Schmid mail@sebastian-schmid.de
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Mail\Db;
|
||||
|
||||
class MailAccount {
|
||||
|
||||
private $ocUserId;
|
||||
private $mailAccountId;
|
||||
private $mailAccountName;
|
||||
private $email;
|
||||
private $inboundHost;
|
||||
private $inboundHostPort;
|
||||
private $inboundSslMode;
|
||||
private $inboundUser;
|
||||
private $inboundPassword;
|
||||
private $inboundService;
|
||||
private $outboundHost;
|
||||
private $outboundHostPort;
|
||||
private $outboundSslMode;
|
||||
private $outboundUser;
|
||||
private $outboundPassword;
|
||||
private $outboundService;
|
||||
|
||||
public function __construct($fromRow=null){
|
||||
if($fromRow){
|
||||
$this->fromRow($fromRow);
|
||||
}
|
||||
}
|
||||
|
||||
public function getOcUserId(){
|
||||
return $this->ocUserId;
|
||||
}
|
||||
|
||||
public function setOcUserId($ocUserId){
|
||||
$this->ocUserId = $ocUserId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMailAccountId(){
|
||||
return $this->mailAccountId;
|
||||
}
|
||||
|
||||
public function setMailAccountId($mailAccountId){
|
||||
$this->mailAccountId = $mailAccountId;
|
||||
}
|
||||
|
||||
public function getMailAccountName(){
|
||||
return $this->mailAccountName;
|
||||
}
|
||||
|
||||
public function setMailAccountName($mailAccountName){
|
||||
$this->mailAccountName = $mailAccountName;
|
||||
}
|
||||
|
||||
public function getEmail(){
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setEmail($email){
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
public function getInboundHost(){
|
||||
return $this->inboundHost;
|
||||
}
|
||||
|
||||
public function setInboundHost($inboundHost){
|
||||
$this->inboundHost = $inboundHost;
|
||||
}
|
||||
|
||||
public function getInboundHostPort(){
|
||||
return $this->inboundHostPort;
|
||||
}
|
||||
|
||||
public function setInboundHostPort($inboundHostPort){
|
||||
$this->inboundHostPort = $inboundHostPort;
|
||||
}
|
||||
|
||||
public function getInboundSslMode(){
|
||||
return $this->inboundSslMode;
|
||||
}
|
||||
|
||||
public function setInboundSslMode($inboundSslMode){
|
||||
$this->inboundSslMode = $inboundSslMode;
|
||||
}
|
||||
|
||||
public function getInboundUser(){
|
||||
return $this->inboundUser;
|
||||
}
|
||||
|
||||
public function setInboundUser($inboundUser){
|
||||
$this->inboundUser = $inboundUser;
|
||||
}
|
||||
|
||||
public function getInboundPassword(){
|
||||
//return $this->decryptPassword($this->inboundPassword);
|
||||
return $this->inboundPassword;
|
||||
}
|
||||
|
||||
public function setInboundPassword($inboundPassword){
|
||||
//$this->inboundPassword = $this->encryptPassword($inboundPassword);
|
||||
$this->inboundPassword = $inboundPassword;
|
||||
}
|
||||
|
||||
public function getInboundService(){
|
||||
return $this->inboundService;
|
||||
}
|
||||
|
||||
public function setInboundService($inboundService){
|
||||
$this->inboundService = $inboundService;
|
||||
}
|
||||
|
||||
public function getOutboundHost(){
|
||||
return $this->outboundHost;
|
||||
}
|
||||
|
||||
public function setOutboundHost($outboundHost){
|
||||
$this->outboundHost = $outboundHost;
|
||||
}
|
||||
|
||||
public function getOutboundHostPort(){
|
||||
return $this->outboundHostPort;
|
||||
}
|
||||
|
||||
public function setOutboundHostPort($outboundHostPort){
|
||||
$this->outboundHostPort = $outboundHostPort;
|
||||
}
|
||||
|
||||
public function getOutboundSslMode(){
|
||||
return $this->outboundSslMode;
|
||||
}
|
||||
|
||||
public function setOutboundSslMode($outboundSslMode){
|
||||
$this->outboundSslMode = $outboundSslMode;
|
||||
}
|
||||
|
||||
public function getOutboundUser(){
|
||||
return $this->outboundUser;
|
||||
}
|
||||
|
||||
public function setOutboundUser($outboundUser){
|
||||
$this->outboundUser = $outboundUser;
|
||||
}
|
||||
|
||||
public function getOutboundPassword(){
|
||||
//return $this->decryptPassword($this->outboundPassword);
|
||||
return $this->outboundPassword;
|
||||
}
|
||||
|
||||
public function setOutboundPassword($outboundPassword){
|
||||
//$this->outboundPassword = $this->encryptPassword($outboundPassword);
|
||||
$this->outboundPassword = $outboundPassword;
|
||||
}
|
||||
|
||||
public function getOutboundService(){
|
||||
return $this->outboundService;
|
||||
}
|
||||
|
||||
public function setOutboundService($outboundService){
|
||||
$this->outboundService = $outboundService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toJson() {
|
||||
return array(
|
||||
'accountId' => $this->getMailAccountId(),
|
||||
'name' => $this->getMailAccountName(),
|
||||
'email' => $this->getEmail(),
|
||||
'imap-host' => $this->getInboundHost(),
|
||||
'imap-port' => $this->getInboundHostPort(),
|
||||
'imap-user' => $this->getInboundUser(),
|
||||
'imap-password' => $this->getInboundPassword(),
|
||||
'imap-ssl-mode' => $this->getInboundSslMode(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* private functions
|
||||
*/
|
||||
private function fromRow($row){
|
||||
$this->ocUserId = $row['ocuserid'];
|
||||
$this->mailAccountId = $row['mailaccountid'];
|
||||
$this->mailAccountName = $row['mailaccountname'];
|
||||
$this->email = $row['email'];
|
||||
$this->inboundHost = $row['inboundhost'];
|
||||
$this->inboundHostPort = $row['inboundhostport'];
|
||||
$this->inboundSslMode = $row['inboundsslmode'];
|
||||
$this->inboundUser = $row['inbounduser'];
|
||||
$this->inboundPassword = $row['inboundpassword'];
|
||||
$this->inboundService = $row['inboundservice'];
|
||||
$this->outboundHost = $row['outboundhost'];
|
||||
$this->outboundHostPort = $row['outboundhostport'];
|
||||
$this->outboundSslMode = $row['outboundsslmode'];
|
||||
$this->outboundUser = $row['outbounduser'];
|
||||
$this->outboundPassword = $row['outboundpassword'];
|
||||
$this->outboundService = $row['outboundservice'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $decryptedPassword
|
||||
* @return string the encrypted password
|
||||
*/
|
||||
private function encryptPassword($decryptedPassword){
|
||||
return $this->ciphering(false, $decryptedPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $encryptedPassword
|
||||
* @return string the decrypted password
|
||||
*/
|
||||
private function decryptPassword($encryptedPassword){
|
||||
return $this->ciphering(true, $encryptedPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function does the encryption and decryption of the password
|
||||
* @param bool $encrypted if true then the string $password will be decrypted
|
||||
* @param string $password
|
||||
* @param string $salt
|
||||
* @return string the password encrypted or decrypted as a string
|
||||
*/
|
||||
private function ciphering($encrypted, $password, $salt='!oScf3b0!7w%rLd13'){
|
||||
// create the key which is a SHA256 hash of $salt and $ocUserId
|
||||
$key = hash('SHA256', $salt . $this->ocUserId, true);
|
||||
|
||||
// open cipher using block size 128-bit to be AES compliant in CBC mode
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
|
||||
|
||||
// create a initialization vector (iv)
|
||||
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_DEV_RANDOM);
|
||||
|
||||
// initialize encryption/decryption using the generated key
|
||||
mcrypt_generic_init($td, $key, $iv);
|
||||
|
||||
if($encrypted){
|
||||
// decrypt encrypted password
|
||||
$password = mdecrypt_generic($td, $password);
|
||||
// close decryption handler
|
||||
mcrypt_generic_deinit($td);
|
||||
}else{
|
||||
// encrypt password
|
||||
$password = mcrypt_generic($td, $password);
|
||||
// close encryption handler
|
||||
mcrypt_generic_deinit($td);
|
||||
}
|
||||
|
||||
// close cipher
|
||||
mcrypt_module_close($td);
|
||||
|
||||
return $password;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
<?php
|
||||
/**
|
||||
* ownCloud - Mail app
|
||||
*
|
||||
* @author Sebastian Schmid
|
||||
* @copyright 2013 Sebastian Schmid mail@sebastian-schmid.de
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Mail\Db;
|
||||
|
||||
use OCP\AppFramework\Db\Mapper;
|
||||
use OCP\IDb;
|
||||
|
||||
class MailAccountMapper extends Mapper {
|
||||
|
||||
// public function __construct(IDb $db, $tableName, $entityClass=null){
|
||||
|
||||
public function __construct(IDb $db){
|
||||
parent::__construct($db, 'mail_mailaccounts');
|
||||
}
|
||||
|
||||
/** Finds an Mail Account by id
|
||||
*
|
||||
* @param int $userId
|
||||
* @param int $mailAccountId
|
||||
* @return MailAccount
|
||||
*/
|
||||
public function find($userId, $mailAccountId){
|
||||
$sql = 'SELECT * FROM `' . $this->getTableName() . '` WHERE ocuserid = ? and mailaccountid = ?';
|
||||
$params = array($userId, $mailAccountId);
|
||||
|
||||
$row = $this->findOneQuery($sql, $params);
|
||||
return new MailAccount($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all Mail Accounts by user id existing for this user
|
||||
* @param string $userId the id of the user that we want to find
|
||||
* @param $userId
|
||||
* @return MailAccount[]
|
||||
*/
|
||||
public function findByUserId($userId){
|
||||
$sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE ocuserid = ?';
|
||||
$params = array($userId);
|
||||
|
||||
$result = $this->execute($sql, $params);
|
||||
$mailAccounts = array();
|
||||
while( $row = $result->fetchRow()) {
|
||||
$mailAccount = new MailAccount($row);
|
||||
$mailAccounts[] = $mailAccount;
|
||||
}
|
||||
|
||||
return $mailAccounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves an User Account into the database
|
||||
* @param MailAccount $mailAccount
|
||||
* @internal param \OCA\Mail\Db\Account $User $userAccount the User Account to be saved
|
||||
* @return MailAccount with the filled in mailaccountid
|
||||
*/
|
||||
public function save($mailAccount){
|
||||
$sql = 'INSERT INTO ' . $this->getTableName() . '(
|
||||
`ocuserid`,
|
||||
`mailaccountid`,
|
||||
`mailaccountname`,
|
||||
`email`,
|
||||
`inboundhost`,
|
||||
`inboundhostport`,
|
||||
`inboundsslmode`,
|
||||
`inbounduser`,
|
||||
`inboundpassword`,
|
||||
`inboundservice`,
|
||||
`outboundhost`,
|
||||
`outboundhostport`,
|
||||
`outboundsslmode`,
|
||||
`outbounduser`,
|
||||
`outboundpassword`,
|
||||
`outboundservice`
|
||||
)' . 'VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
||||
|
||||
$params = array(
|
||||
$mailAccount->getOcUserId(),
|
||||
$mailAccount->getMailAccountId(),
|
||||
$mailAccount->getMailAccountName(),
|
||||
$mailAccount->getEmail(),
|
||||
$mailAccount->getInboundHost(),
|
||||
$mailAccount->getInboundHostPort(),
|
||||
$mailAccount->getInboundSslMode(),
|
||||
$mailAccount->getInboundUser(),
|
||||
$mailAccount->getInboundPassword(),
|
||||
$mailAccount->getInboundService(),
|
||||
$mailAccount->getOutboundHost(),
|
||||
$mailAccount->getOutboundHostPort(),
|
||||
$mailAccount->getOutboundSslMode(),
|
||||
$mailAccount->getOutboundUser(),
|
||||
$mailAccount->getOutboundPassword(),
|
||||
$mailAccount->getOutboundService()
|
||||
);
|
||||
|
||||
$this->execute($sql, $params);
|
||||
|
||||
return $mailAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a Mail Account
|
||||
* @param MailAccount $mailAccount
|
||||
*/
|
||||
/*public function update($mailAccount){
|
||||
$sql = 'UPDATE ' . $this->getTableName() . 'SET
|
||||
`mailaccountname` = ?,
|
||||
`email` = ?,
|
||||
`inboundhost` = ?,
|
||||
`inboundhostport` = ?,
|
||||
`inboundsslmode` = ?,
|
||||
`inbounduser` = ?,
|
||||
`inboundpassword` = ?,
|
||||
`inboundservice` = ?,
|
||||
`outboundhost` = ?,
|
||||
`outboundhostport` = ?,
|
||||
`outboundsslmode` = ?,
|
||||
`outbounduser` = ?,
|
||||
`outboundpassword` = ?,
|
||||
`outboundservice` = ?
|
||||
WHERE `mailaccountid` = ?';
|
||||
|
||||
$params = array(
|
||||
$mailAccount->getMailAccountName(),
|
||||
$mailAccount->getEmail(),
|
||||
$mailAccount->getInboundHost(),
|
||||
$mailAccount->getInboundHostPort(),
|
||||
$mailAccount->getInboundSslMode(),
|
||||
$mailAccount->getInboundUser(),
|
||||
$mailAccount->getInboundPassword(),
|
||||
$mailAccount->getInboundService(),
|
||||
$mailAccount->getOutboundHost(),
|
||||
$mailAccount->getOutboundHostPort(),
|
||||
$mailAccount->getOutboundSslMode(),
|
||||
$mailAccount->getOutboundUser(),
|
||||
$mailAccount->getOutboundPassword(),
|
||||
$mailAccount->getOutboundService(),
|
||||
$mailAccount->getMailAccountId()
|
||||
);
|
||||
|
||||
$this->execute($sql, $params);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @param int $mailAccountId
|
||||
*/
|
||||
public function delete($accountId){
|
||||
$this->delete($this->getTableName(), $accountId);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
/**
|
||||
* ownCloud - Mail
|
||||
*
|
||||
* @author Sebastian Schmid
|
||||
* @copyright 2013 Sebastian Schmid mail@sebastian-schmid.de
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Mail\Db;
|
||||
|
||||
|
||||
use OCP\AppFramework\Db\MapperTestUtility;
|
||||
|
||||
class MailAccountMapperTest extends MapperTestUtility {
|
||||
|
||||
/**
|
||||
* @var MailAccountMapper
|
||||
*/
|
||||
private $mapper;
|
||||
|
||||
/**
|
||||
* @var MailAccount
|
||||
*/
|
||||
private $mailAccount;
|
||||
|
||||
private $row = array(
|
||||
'ocuserid' => 1,
|
||||
'mailaccountid' => 1,
|
||||
'mailaccountname' => 'Account 1',
|
||||
'email' => 'octest@octest.org',
|
||||
'inboundhost' => 'octest.org',
|
||||
'inboundhostport' => '993',
|
||||
'inboundsslmode' => '',
|
||||
'inbounduser' => 'test',
|
||||
'inboundpassword' => 'test',
|
||||
'inboundservice' => '',
|
||||
'outboundhost' => 'octest.org',
|
||||
'outboundhostport' => '143',
|
||||
'outboundsslmode' => '',
|
||||
'outbounduser' => 'test',
|
||||
'outboundpassword' => 'test',
|
||||
'outboundservice' => ''
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize Mapper
|
||||
*/
|
||||
public function setup(){
|
||||
$this->mapper = new MailAccountMapper($this->db);
|
||||
|
||||
$this->mailAccount = new MailAccount($this->row);
|
||||
}
|
||||
|
||||
public function testTableName(){
|
||||
$this->assertSame('*PREFIX*mail_mailaccounts', $this->mapper->getTableName());
|
||||
}
|
||||
|
||||
public function testFind(){
|
||||
$userId = $this->mailAccount->getOcUserId();
|
||||
$mailAccountId = $this->mailAccount->getMailAccountId();
|
||||
|
||||
$sql = 'SELECT * FROM ' . $this->mapper->getTableName() . ' WHERE ocuserid = ? and mailaccountid = ?';
|
||||
|
||||
$this->setMapperResult($sql, array($userId, $mailAccountId), new MailAccount($this->row));
|
||||
|
||||
$result = $this->mapper->find($userId, $mailAccountId);
|
||||
$this->assertEquals($this->mailAccount, $result);
|
||||
}
|
||||
|
||||
public function testFindByUserId(){
|
||||
|
||||
}
|
||||
|
||||
public function testSave(){
|
||||
|
||||
}
|
||||
|
||||
public function testUpdate(){
|
||||
|
||||
}
|
||||
|
||||
public function testDelete(){
|
||||
}
|
||||
}
|
|
@ -0,0 +1,326 @@
|
|||
<?php
|
||||
/**
|
||||
* ownCloud - Mail
|
||||
*
|
||||
* @author Sebastian Schmid
|
||||
* @copyright 2013 Sebastian Schmid mail@sebastian-schmid.de
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Mail\Db;
|
||||
|
||||
|
||||
class TestMailAccount extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
private $row = array(
|
||||
'ocuserid' => 1,
|
||||
'mailaccountid' => 1,
|
||||
'mailaccountname' => 'Account 1',
|
||||
'email' => 'octest@octest.org',
|
||||
'inboundhost' => 'octest.org',
|
||||
'inboundhostport' => '993',
|
||||
'inboundsslmode' => '',
|
||||
'inbounduser' => 'test',
|
||||
'inboundpassword' => 'test',
|
||||
'inboundservice' => '',
|
||||
'outboundhost' => 'octest.org',
|
||||
'outboundhostport' => '143',
|
||||
'outboundsslmode' => '',
|
||||
'outbounduser' => 'test',
|
||||
'outboundpassword' => 'test',
|
||||
'outboundservice' => ''
|
||||
);
|
||||
|
||||
private $setVars = array(
|
||||
'ocuserid' => 1,
|
||||
'mailaccountid' => 1,
|
||||
'mailaccountname' => 'Account 2',
|
||||
'email' => 'octest@octest.org',
|
||||
'inboundhost' => 'octest.org',
|
||||
'inboundhostport' => '993',
|
||||
'inboundsslmode' => '',
|
||||
'inbounduser' => 'test',
|
||||
'inboundpassword' => 'test',
|
||||
'inboundservice' => '',
|
||||
'outboundhost' => 'octest.org',
|
||||
'outboundhostport' => '143',
|
||||
'outboundsslmode' => '',
|
||||
'outbounduser' => 'test',
|
||||
'outboundpassword' => 'test',
|
||||
'outboundservice' => ''
|
||||
);
|
||||
|
||||
/**
|
||||
* @var \OCA\Mail\Db\MailAccount
|
||||
*/
|
||||
private $mailAccount;
|
||||
|
||||
/**
|
||||
* Initialize MailAccount Object
|
||||
*/
|
||||
protected function setup(){
|
||||
$this->mailAccount = new MailAccount($this->row);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if all Getter Methods of MailAccount returning the correct values
|
||||
*/
|
||||
public function testGetOcUserId(){
|
||||
$expectedOcUserId = $this->row['ocuserid'];
|
||||
$ocUserId = $this->mailAccount->getOcUserId();
|
||||
|
||||
$this->assertSame($expectedOcUserId, $ocUserId);
|
||||
}
|
||||
|
||||
public function testGetMailAccountId(){
|
||||
$expectedMailAccountId = $this->row['mailaccountid'];
|
||||
$mailAccountId = $this->mailAccount->getMailAccountId();
|
||||
|
||||
$this->assertSame($expectedMailAccountId, $mailAccountId);
|
||||
}
|
||||
|
||||
public function testGetMailAccountName(){
|
||||
$expectedMailAccountName = $this->row['mailaccountname'];
|
||||
$mailAccountName = $this->mailAccount->getMailAccountName();
|
||||
|
||||
$this->assertSame($expectedMailAccountName, $mailAccountName);
|
||||
}
|
||||
|
||||
public function testGetEmail(){
|
||||
$expectedEmail = $this->row['email'];
|
||||
$email = $this->mailAccount->getEmail();
|
||||
|
||||
$this->assertSame($expectedEmail, $email);
|
||||
}
|
||||
|
||||
public function testGetInboundHost(){
|
||||
$expectedInboundHost = $this->row['inboundhost'];
|
||||
$inboundHost = $this->mailAccount->getInboundHost();
|
||||
|
||||
$this->assertSame($expectedInboundHost, $inboundHost);
|
||||
}
|
||||
|
||||
public function testGetInboundHostPort(){
|
||||
$expectedInboundHostPort = $this->row['inboundhostport'];
|
||||
$inboundHostPort = $this->mailAccount->getInboundHostPort();
|
||||
|
||||
$this->assertSame($expectedInboundHostPort, $inboundHostPort);
|
||||
}
|
||||
|
||||
public function testGetInboundSslMode(){
|
||||
$expectedInboundSslMode = $this->row['inboundsslmode'];
|
||||
$inboundSslMode = $this->mailAccount->getInboundSslMode();
|
||||
|
||||
$this->assertSame($expectedInboundSslMode, $inboundSslMode);
|
||||
}
|
||||
|
||||
public function testGetInboundUser(){
|
||||
$expectedInboundUser = $this->row['inbounduser'];
|
||||
$inboundUser = $this->mailAccount->getInboundUser();
|
||||
|
||||
$this->assertSame($expectedInboundUser, $inboundUser);
|
||||
}
|
||||
|
||||
public function testGetInboundPassword(){
|
||||
$expectedInboundPassword = $this->row['inboundpassword'];
|
||||
$inboundPassword = $this->mailAccount->getInboundPassword();
|
||||
|
||||
$this->assertSame($expectedInboundPassword, $inboundPassword);
|
||||
}
|
||||
|
||||
public function testGetInboundService(){
|
||||
$expectedInboundService = $this->row['inboundservice'];
|
||||
$inboundService = $this->mailAccount->getInboundService();
|
||||
|
||||
$this->assertSame($expectedInboundService, $inboundService);
|
||||
}
|
||||
|
||||
public function testGetOutboundHost(){
|
||||
$expectedOutboundHost = $this->row['outboundhost'];
|
||||
$outboundHost = $this->mailAccount->getOutboundHost();
|
||||
|
||||
$this->assertSame($expectedOutboundHost, $outboundHost);
|
||||
}
|
||||
|
||||
public function testGetOutboundHostPort(){
|
||||
$expectedOutboundHostPort = $this->row['outboundhostport'];
|
||||
$outboundHostPort = $this->mailAccount->getOutboundHostPort();
|
||||
|
||||
$this->assertSame($expectedOutboundHostPort, $outboundHostPort);
|
||||
}
|
||||
|
||||
public function testGetOutboundSslMode(){
|
||||
$expectedOutboundSslMode = $this->row['outboundsslmode'];
|
||||
$outboundSslMode = $this->mailAccount->getOutboundSslMode();
|
||||
|
||||
$this->assertSame($expectedOutboundSslMode, $outboundSslMode);
|
||||
}
|
||||
|
||||
public function testGetOutboundUser(){
|
||||
$expectedOutboundUser = $this->row['outbounduser'];
|
||||
$outboundUser = $this->mailAccount->getOutboundUser();
|
||||
|
||||
$this->assertSame($expectedOutboundUser, $outboundUser);
|
||||
}
|
||||
|
||||
public function testGetOutboundPassword(){
|
||||
$expectedOutboundPassword = $this->row['outboundpassword'];
|
||||
$outboundPassword = $this->mailAccount->getOutboundPassword();
|
||||
|
||||
$this->assertSame($expectedOutboundPassword, $outboundPassword);
|
||||
}
|
||||
|
||||
public function testGetOutboundService(){
|
||||
$expectedOutboundService = $this->row['outboundservice'];
|
||||
$outboundService = $this->mailAccount->getOutboundService();
|
||||
|
||||
$this->assertSame($expectedOutboundService, $outboundService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test all Setter Methods of MailAccount
|
||||
*/
|
||||
public function testSetOcUserId(){
|
||||
$expectedOcUserId = $this->setVars['ocuserid'];
|
||||
$this->mailAccount->setOcUserId($expectedOcUserId);
|
||||
$ocUserId = $this->mailAccount->getOcUserId();
|
||||
|
||||
$this->assertSame($expectedOcUserId, $ocUserId);
|
||||
}
|
||||
|
||||
public function testSetMailAccountId(){
|
||||
$expectedMailAccountId = $this->setVars['mailaccountid'];
|
||||
$this->mailAccount->setMailAccountId($expectedMailAccountId);
|
||||
$mailAccountId = $this->mailAccount->getMailAccountId();
|
||||
|
||||
$this->assertSame($expectedMailAccountId, $mailAccountId);
|
||||
}
|
||||
|
||||
public function testSetMailAccountName(){
|
||||
$expectedMailAccountName = $this->setVars['mailaccountname'];
|
||||
$this->mailAccount->setMailAccountName($expectedMailAccountName);
|
||||
$mailAccountName = $this->mailAccount->getMailAccountName();
|
||||
|
||||
$this->assertSame($expectedMailAccountName, $mailAccountName);
|
||||
}
|
||||
|
||||
public function testSetEmail(){
|
||||
$expectedEmail = $this->setVars['email'];
|
||||
$this->mailAccount->setEmail($expectedEmail);
|
||||
$email = $this->mailAccount->getEmail();
|
||||
|
||||
$this->assertSame($expectedEmail, $email);
|
||||
}
|
||||
|
||||
public function testSetInboundHost(){
|
||||
$expectedInboundHost = $this->setVars['inboundhost'];
|
||||
$this->mailAccount->setInboundHost($expectedInboundHost);
|
||||
$inboundHost = $this->mailAccount->getInboundHost();
|
||||
|
||||
$this->assertSame($expectedInboundHost, $inboundHost);
|
||||
}
|
||||
|
||||
public function testSetInboundHostPort(){
|
||||
$expectedInboundHostPort = $this->setVars['inboundhostport'];
|
||||
$this->mailAccount->setInboundHost($expectedInboundHostPort);
|
||||
$inboundHostPort = $this->mailAccount->getInboundHostPort();
|
||||
|
||||
$this->assertSame($expectedInboundHostPort, $inboundHostPort);
|
||||
}
|
||||
|
||||
public function testSetInboundSslMode(){
|
||||
$expectedInboundSslMode = $this->setVars['inboundsslmode'];
|
||||
$this->mailAccount->setInboundSslMode($expectedInboundSslMode);
|
||||
$inboundSslMode = $this->mailAccount->getInboundSslMode();
|
||||
|
||||
$this->assertSame($expectedInboundSslMode, $inboundSslMode);
|
||||
}
|
||||
|
||||
public function testSetInboundUser(){
|
||||
$expectedInboundUser = $this->setVars['inbounduser'];
|
||||
$this->mailAccount->setInboundUser($expectedInboundUser);
|
||||
$inboundUser = $this->mailAccount->getInboundUser();
|
||||
|
||||
$this->assertSame($expectedInboundUser, $inboundUser);
|
||||
}
|
||||
|
||||
public function testSetInboundPassword(){
|
||||
$expectedInboundPassword = $this->setVars['inboundpassword'];
|
||||
$this->mailAccount->setInboundPassword($expectedInboundPassword);
|
||||
$inboundPassword = $this->mailAccount->getInboundPassword();
|
||||
|
||||
$this->assertSame($expectedInboundPassword, $inboundPassword);
|
||||
}
|
||||
|
||||
public function testSetInboundService(){
|
||||
$expectedInboundService = $this->setVars['inboundservice'];
|
||||
$this->mailAccount->setInboundService($expectedInboundService);
|
||||
$inboundService = $this->mailAccount->getInboundService();
|
||||
|
||||
$this->assertSame($expectedInboundService, $inboundService);
|
||||
}
|
||||
|
||||
//outboundOutboundoutbound
|
||||
public function testSetOutboundHost(){
|
||||
$expectedOutboundHost = $this->setVars['outboundhost'];
|
||||
$this->mailAccount->setOutboundHost($expectedOutboundHost);
|
||||
$outboundHost = $this->mailAccount->getOutboundHost();
|
||||
|
||||
$this->assertSame($expectedOutboundHost, $outboundHost);
|
||||
}
|
||||
|
||||
public function testSetOutboundHostPort(){
|
||||
$expectedOutboundHostPort = $this->setVars['outboundhostport'];
|
||||
$this->mailAccount->setOutboundHost($expectedOutboundHostPort);
|
||||
$outboundHostPort = $this->mailAccount->getOutboundHostPort();
|
||||
|
||||
$this->assertSame($expectedOutboundHostPort, $outboundHostPort);
|
||||
}
|
||||
|
||||
public function testSetOutboundSslMode(){
|
||||
$expectedOutboundSslMode = $this->setVars['outboundsslmode'];
|
||||
$this->mailAccount->setOutboundSslMode($expectedOutboundSslMode);
|
||||
$outboundSslMode = $this->mailAccount->getOutboundSslMode();
|
||||
|
||||
$this->assertSame($expectedOutboundSslMode, $outboundSslMode);
|
||||
}
|
||||
|
||||
public function testSetOutboundUser(){
|
||||
$expectedOutboundUser = $this->setVars['outbounduser'];
|
||||
$this->mailAccount->setOutboundUser($expectedOutboundUser);
|
||||
$outboundUser = $this->mailAccount->getOutboundUser();
|
||||
|
||||
$this->assertSame($expectedOutboundUser, $outboundUser);
|
||||
}
|
||||
|
||||
public function testSetOutboundPassword(){
|
||||
$expectedOutboundPassword = $this->setVars['outboundpassword'];
|
||||
$this->mailAccount->setOutboundPassword($expectedOutboundPassword);
|
||||
$outboundPassword = $this->mailAccount->getOutboundPassword();
|
||||
|
||||
$this->assertSame($expectedOutboundPassword, $outboundPassword);
|
||||
}
|
||||
|
||||
public function testSetOutboundService(){
|
||||
$expectedOutboundService = $this->setVars['outboundservice'];
|
||||
$this->mailAccount->setOutboundService($expectedOutboundService);
|
||||
$outboundService = $this->mailAccount->getOutboundService();
|
||||
|
||||
$this->assertSame($expectedOutboundService, $outboundService);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Загрузка…
Ссылка в новой задаче