2 require_once 'modules/Accounts/Account.php';
4 class SugarTestAccountUtilities
6 private static $_createdAccounts = array();
8 private function __construct() {}
10 public static function createAccount($id = '')
13 $name = 'SugarAccount';
14 $email1 = 'account@sugar.com';
15 $account = new Account();
16 $account->name = $name . $time;
17 $account->email1 = 'account@'. $time. 'sugar.com';
20 $account->new_with_id = true;
24 self::$_createdAccounts[] = $account;
28 public static function setCreatedAccount($account_ids) {
29 foreach($account_ids as $account_id) {
30 $account = new Account();
31 $account->id = $account_id;
32 self::$_createdAccounts[] = $account;
36 public static function removeAllCreatedAccounts()
38 $account_ids = self::getCreatedAccountIds();
39 $GLOBALS['db']->query('DELETE FROM accounts WHERE id IN (\'' . implode("', '", $account_ids) . '\')');
42 public static function getCreatedAccountIds()
44 $account_ids = array();
45 foreach (self::$_createdAccounts as $account) {
46 $account_ids[] = $account->id;