Exemple #1
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     self::$marketingList = MarketingListTestHelper::createMarketingListByName('a new list');
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     $account2 = AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
     $contact1 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact', $super, $account);
     $contact2 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact2', $super, $account2);
     $contact3 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact3', $super, $account);
     $contact4 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact4', $super, $account2);
     $contact5 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact5', $super, $account);
     $marketingList1 = MarketingListTestHelper::createMarketingListByName('MarketingList1', 'MarketingList Description1');
     $marketingList2 = MarketingListTestHelper::createMarketingListByName('MarketingList2', 'MarketingList Description2');
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact1);
     MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList1, $contact2);
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact3);
     MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList1, $contact4);
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact5);
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList2, $contact1);
     MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList2, $contact2);
     AllPermissionsOptimizationUtil::rebuild();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
     Yii::app()->user->userModel = SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = User::getByUsername('super');
     SecurityTestHelper::createUsers();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     SecurityTestHelper::createGroups();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     SecurityTestHelper::createGroups();
     SecurityTestHelper::createRoles();
     RedBeanModel::forgetAll();
     //do the rebuild to ensure the tables get created properly.
     ReadPermissionsOptimizationUtil::rebuild();
     //Manually build the test model munge tables.
     ReadPermissionsOptimizationUtil::recreateTable(ReadPermissionsOptimizationUtil::getMungeTableName('OwnedSecurableTestItem'));
     ReadPermissionsOptimizationUtil::recreateTable(ReadPermissionsOptimizationUtil::getMungeTableName('OwnedSecurableTestItem2'));
     $benny = User::getByUsername('benny');
     $model = new OwnedSecurableTestItem();
     $model->member = 'test';
     assert($model->save());
     // Not Coding Standard
     $model = new OwnedSecurableTestItem();
     $model->member = 'test2';
     assert($model->save());
     // Not Coding Standard
     $model = new OwnedSecurableTestItem();
     $model->member = 'test3';
     $model->owner = $benny;
     assert($model->save());
     // Not Coding Standard
     assert(OwnedSecurableTestItem::getCount() == 3);
     // Not Coding Standard
     $model = new OwnedSecurableTestItem2();
     $model->member = 'test5';
     assert($model->save());
     // Not Coding Standard
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = User::getByUsername('super');
     ReadPermissionsOptimizationUtil::rebuild();
     SecurityTestHelper::createUsers();
     $billy = User::getByUsername('billy');
     EmailMessageTestHelper::createEmailAccount($billy);
     $billy->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
     $billy->setRight('ContactsModule', ContactsModule::RIGHT_CREATE_CONTACTS);
     $billy->setRight('ContactsModule', ContactsModule::RIGHT_DELETE_CONTACTS);
     assert($billy->save());
     // Not Coding Standard
     $contact = ContactTestHelper::createContactByNameForOwner('sally', Yii::app()->user->userModel);
     $contact->primaryEmail = new Email();
     $contact->primaryEmail->emailAddress = '*****@*****.**';
     $contact->secondaryEmail->emailAddress = '*****@*****.**';
     $contact->addPermissions($billy, Permission::READ);
     $contact->addPermissions($billy, Permission::WRITE);
     $contact->save();
     $molly = ContactTestHelper::createContactByNameForOwner('molly', User::getByUsername('bobby'));
     $molly->primaryEmail = new Email();
     $molly->primaryEmail->emailAddress = '*****@*****.**';
     $molly->secondaryEmail->emailAddress = '*****@*****.**';
     $contact->save();
     ReadPermissionsOptimizationUtil::securableItemGivenPermissionsForUser($contact, $billy);
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     $super = User::getByUsername('super');
     $super->primaryEmail->emailAddress = '*****@*****.**';
     $saved = $super->save();
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     MarketingListTestHelper::createMarketingListByName('testMarketingList');
     $campaign = CampaignTestHelper::createCampaign('testCampaign', 'testSubject', 'testContent', 'testHtmlContent');
     $contact = ContactTestHelper::createContactByNameForOwner('test', $super);
     $emailMessage = EmailMessageTestHelper::createArchivedUnmatchedSentMessage($super);
     $campaignItem = new CampaignItem();
     $campaignItem->contact = $contact;
     $campaignItem->processed = true;
     $campaignItem->campaign = $campaign;
     $campaignItem->emailMessage = $emailMessage;
     $campaignItem->unrestrictedSave();
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     AllPermissionsOptimizationUtil::rebuild();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     // set up data owned by super
     Yii::app()->user->userModel = User::getByUsername('super');
     $account1 = AccountTestHelper::createAccountByNameForOwner('account1', Yii::app()->user->userModel);
     $contact1 = ContactTestHelper::createContactWithAccountByNameForOwner('contact1', Yii::app()->user->userModel, $account1);
     $contact2 = ContactTestHelper::createContactWithAccountByNameForOwner('contact2', Yii::app()->user->userModel, $account1);
     $contact3 = ContactTestHelper::createContactWithAccountByNameForOwner('contact3', Yii::app()->user->userModel, $account1);
     $marketingList1 = MarketingListTestHelper::createMarketingListByName('MarketingList1');
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact1);
     MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList1, $contact2);
     $member1 = MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact3);
     static::$superUserMarketingListId = $marketingList1->id;
     static::$superUserMemberId = $member1->id;
     // set up data owned by nobody
     Yii::app()->user->userModel = UserTestHelper::createBasicUser('nobody');
     $account2 = AccountTestHelper::createAccountByNameForOwner('account2', Yii::app()->user->userModel);
     $contact4 = ContactTestHelper::createContactWithAccountByNameForOwner('contact4', Yii::app()->user->userModel, $account2);
     $contact5 = ContactTestHelper::createContactWithAccountByNameForOwner('contact5', Yii::app()->user->userModel, $account2);
     $contact6 = ContactTestHelper::createContactWithAccountByNameForOwner('contact6', Yii::app()->user->userModel, $account2);
     $marketingList2 = MarketingListTestHelper::createMarketingListByName('MarketingList2');
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList2, $contact4);
     $member2 = MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList2, $contact5);
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList2, $contact6);
     static::$regularUserMarketingListId = $marketingList2->id;
     static::$regularUserMemberId = $member2->id;
     ReadPermissionsOptimizationUtil::rebuild();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     // Delete item from jobQueue, that is created when new user is created
     Yii::app()->jobQueue->deleteAll();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     static::$asynchronousPageSize = ExportModule::$asynchronousPageSize;
     static::$asynchronousMaximumModelsToProcess = ExportModule::$asynchronousMaximumModelsToProcess;
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     // Delete item from jobQueue, that is created when new user is created
     Yii::app()->jobQueue->deleteAll();
     self::$marketingList = MarketingListTestHelper::createMarketingListByName('a new list');
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     $account = AccountTestHelper::createAccountByNameForOwner('anAccount2', Yii::app()->user->userModel);
     $task = TaskTestHelper::createTaskWithOwnerAndRelatedAccount('startTask', $super, $account);
     $task->delete();
     ZurmoRedBean::exec('delete from activity_item');
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
     SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = User::getByUsername('super');
     SecurityTestHelper::createUsers();
     SecurityTestHelper::createGroups();
     SecurityTestHelper::createAccounts();
     AllPermissionsOptimizationUtil::rebuild();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     SecurityTestHelper::createGroups();
     SecurityTestHelper::createRoles();
     //Forget the cache, otherwise user/role/group information is not properly reflected in the cache.
     RedBeanModel::forgetAll();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Create some extra users
     SecurityTestHelper::createUsers();
     $confused = UserTestHelper::createBasicUser('confused');
     $nobody = UserTestHelper::createBasicUser('nobody');
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = SecurityTestHelper::createSuperAdmin();
     self::$emailMessage = EmailMessageTestHelper::createDraftSystemEmail('a test message', $super);
     SecurityTestHelper::createUsers();
     SecurityTestHelper::createGroups();
     SecurityTestHelper::createRoles();
     RedBeanModel::forgetAll();
     //do the rebuild to ensure the tables get created properly.
     ReadPermissionsOptimizationUtil::rebuild();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     if (static::$createUsersAndGroups) {
         SecurityTestHelper::createUsers();
         SecurityTestHelper::createGroups();
     }
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     assert($everyoneGroup->save());
     // Not Coding Standard
     static::setRandomNonEveryoneNonAdministratorsGroup();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     for ($i = 0; $i < 10; $i++) {
         MarketingListTestHelper::createMarketingListByName('test marketing List ' . $i);
         ContactTestHelper::createContactWithAccountByNameForOwner('superContact' . $i, $super, $account);
     }
 }
Exemple #20
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = User::getByUsername('super');
     SecurityTestHelper::createUsers();
     SecurityTestHelper::createGroups();
     SecurityTestHelper::createAccounts();
     SecurityTestHelper::createRoles();
     $everyone = Group::getByName('Everyone');
     $saved = $everyone->save();
     assert('$saved');
     // Not Coding Standard
     ReadPermissionsOptimizationUtil::rebuild();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     $imap = new ZurmoImap();
     $imap->imapHost = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapHost'];
     $imap->imapUsername = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapUsername'];
     $imap->imapPassword = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapPassword'];
     $imap->imapPort = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapPort'];
     $imap->imapSSL = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapSSL'];
     $imap->imapFolder = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapFolder'];
     $imap->init();
     $imap->connect();
     self::$emailHelperSendEmailThroughTransport = Yii::app()->emailHelper->sendEmailThroughTransport;
     self::$userImap = $imap;
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = User::getByUsername('super');
     SecurityTestHelper::createUsers();
     SecurityTestHelper::createGroups();
     SecurityTestHelper::createAccounts();
     SecurityTestHelper::createRoles();
     $everyone = Group::getByName('Everyone');
     $saved = $everyone->save();
     assert('$saved');
     // Not Coding Standard
     //Add contacts to help test that the rebuild is working correctly
     $contact = ContactTestHelper::createContactByNameForOwner('jason', Yii::app()->user->userModel);
     $contact->addPermissions(User::getByUsername('betty'), Permission::READ);
     $contact->addPermissions(Group::getByName('Support Staff'), Permission::READ);
     $saved = $contact->save();
     assert('$saved');
     // Not Coding Standard
     ReadPermissionsOptimizationUtil::rebuild();
     assert('self::getAccountMungeRowCount() == 0');
     // Not Coding Standard
 }
Exemple #23
0
 public function testCannotAddUsersToTheEveryoneGroup()
 {
     SecurityTestHelper::createUsers();
     $users = User::getAll();
     $user = $users[0];
     $group = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $this->assertFalse($group->canModifyMemberships());
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     self::$freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         self::$freeze = true;
     }
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     self::$super = User::getByUsername('super');
     Yii::app()->user->userModel = self::$super;
     $currencies = Currency::getAll();
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 100;
     $currencyValue->currency = $currencies[0];
     $multiDropDownCustomFieldData = new CustomFieldData();
     $multiDropDownCustomFieldData->name = 'multiDropDown';
     $multiDropDownCustomFieldData->serializedData = serialize(array('Ten', 11, 'XII'));
     $saved = $multiDropDownCustomFieldData->save();
     assert('$saved');
     // Not Coding Standard
     $multiDropDownCustomFieldValue1 = new CustomFieldValue();
     $multiDropDownCustomFieldValue1->value = 'Ten';
     $multiDropDownCustomFieldValue2 = new CustomFieldValue();
     $multiDropDownCustomFieldValue2->value = 11;
     $multiDropDownCustomFieldValue3 = new CustomFieldValue();
     $multiDropDownCustomFieldValue3->value = 'XII';
     $tagCustomFieldData = new CustomFieldData();
     $tagCustomFieldData->name = 'tagCloud';
     $tagCustomFieldData->serializedData = serialize(array('Apache', 'PHP'));
     $saved = $tagCustomFieldData->save();
     assert('$saved');
     // Not Coding Standard
     $tagCustomFieldValue1 = new CustomFieldValue();
     $tagCustomFieldValue1->value = 'PHP';
     $tagCustomFieldValue2 = new CustomFieldValue();
     $tagCustomFieldValue2->value = 'Apache';
     $primaryEmail = new Email();
     $primaryEmail->emailAddress = "*****@*****.**";
     $primaryEmail->isInvalid = true;
     $primaryEmail->optOut = false;
     $secondaryEmail = new Email();
     $secondaryEmail->emailAddress = "*****@*****.**";
     $secondaryEmail->isInvalid = false;
     $secondaryEmail->optOut = true;
     $address = new Address();
     $address->street1 = "SomeStreet1";
     $address->street2 = "SomeStreet2";
     $address->city = "SomeCity";
     $address->state = "SomeState";
     $address->postalCode = 1111;
     $address->country = "SomeCountry";
     $likeContactState = new ContactState();
     $likeContactState->name = 'Customer';
     $likeContactState->order = 0;
     $users = User::getAll();
     $user = new User();
     $user->lastName = 'Kevin';
     $user->hash = 'rieWoy3aijohP6chaigaokohs1oovohf';
     $user->language = 'es';
     $user->timeZone = 'America/Chicago';
     $user->username = '******';
     $user->currency = $currencies[0];
     $user->manager = $users[0];
     //Custom attribute
     $attributeForm = new TextAttributeForm();
     $attributeForm->attributeName = 'custom';
     $attributeForm->attributeLabels = array('en' => 'test label en');
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new EmailTemplateModelTestItem());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $model = new EmailTemplateModelTestItem();
     $model->string = 'abc';
     $model->firstName = 'James';
     $model->lastName = 'Jackson';
     $model->phone = 1122334455;
     $model->boolean = true;
     $model->date = '2008-12-31';
     $model->dateTime = '2008-12-31 07:48:04';
     $model->textArea = 'Multiple Lines\\nOf Text';
     $model->url = 'http://www.zurmo.com/';
     $model->integer = 999;
     $model->float = 999.999;
     $model->currencyValue = $currencyValue;
     $model->dropDown->value = "DropdownSelectedValue";
     $model->radioDropDown->value = "RadioDropdownSelectedValue";
     $model->primaryEmail = $primaryEmail;
     $model->secondaryEmail = $secondaryEmail;
     $model->primaryAddress = $address;
     $model->likeContactState = $likeContactState;
     $model->user = $user;
     $model->multiDropDown->data = $multiDropDownCustomFieldData;
     $model->tagCloud->data = $tagCustomFieldData;
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue1);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue2);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue3);
     $model->tagCloud->values->add($tagCustomFieldValue1);
     $model->tagCloud->values->add($tagCustomFieldValue2);
     $model->customCstm = 'text custom';
     $saved = $model->save();
     assert('$saved');
     // Not Coding Standard
     self::$emailTemplate = $model;
     self::$content = '[[STRING]] [[FIRST^NAME]] [[LAST^NAME]] [[PHONE]]';
     self::$compareContent = 'abc James Jackson 1122334455';
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // We need to unfreeze here as we are working with custom field values
     self::$freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         self::$freeze = true;
     }
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     self::$super = User::getByUsername('super');
     Yii::app()->user->userModel = self::$super;
     $currencies = Currency::getAll();
     $currencyValue1 = new CurrencyValue();
     $currencyValue1->value = 100;
     $currencyValue1->currency = $currencies[0];
     $multiDropDownCustomFieldData1 = new CustomFieldData();
     $multiDropDownCustomFieldData1->name = 'multiDropDown1';
     $multiDropDownCustomFieldData1->serializedData = serialize(array('Ten', 11, 'XII'));
     $saved = $multiDropDownCustomFieldData1->save();
     assert('$saved');
     // Not Coding Standard
     $multiDropDownCustomFieldValue1 = new CustomFieldValue();
     $multiDropDownCustomFieldValue1->value = 'Ten';
     $multiDropDownCustomFieldValue2 = new CustomFieldValue();
     $multiDropDownCustomFieldValue2->value = 11;
     $multiDropDownCustomFieldValue3 = new CustomFieldValue();
     $multiDropDownCustomFieldValue3->value = 'XII';
     $tagCustomFieldData1 = new CustomFieldData();
     $tagCustomFieldData1->name = 'tagCloud1';
     $tagCustomFieldData1->serializedData = serialize(array('Apache', 'PHP'));
     $saved = $tagCustomFieldData1->save();
     assert('$saved');
     // Not Coding Standard
     $tagCustomFieldValue1 = new CustomFieldValue();
     $tagCustomFieldValue1->value = 'PHP';
     $tagCustomFieldValue2 = new CustomFieldValue();
     $tagCustomFieldValue2->value = 'Apache';
     $primaryEmail1 = new Email();
     $primaryEmail1->emailAddress = "*****@*****.**";
     $primaryEmail1->isInvalid = true;
     $primaryEmail1->optOut = false;
     $secondaryEmail1 = new Email();
     $secondaryEmail1->emailAddress = "*****@*****.**";
     $secondaryEmail1->isInvalid = false;
     $secondaryEmail1->optOut = true;
     $address1 = new Address();
     $address1->street1 = "SomeStreet1";
     $address1->street2 = "SomeStreet2";
     $address1->city = "SomeCity";
     $address1->state = "SomeState";
     $address1->postalCode = 1111;
     $address1->country = "SomeCountry";
     $likeContactState1 = new ContactState();
     $likeContactState1->name = 'Customer';
     $likeContactState1->order = 0;
     $users = User::getAll();
     $user1 = new User();
     $user1->lastName = 'Kevin';
     $user1->hash = 'rieWoy3aijohP6chaigaokohs1oovohf';
     $user1->language = 'es';
     $user1->timeZone = 'America/Chicago';
     $user1->username = '******';
     $user1->currency = $currencies[0];
     $user1->manager = $users[0];
     //Custom attribute
     $attributeForm = new TextAttributeForm();
     $attributeForm->attributeName = 'custom';
     $attributeForm->attributeLabels = array('en' => 'test label en');
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new EmailTemplateModelTestItem());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $model = new EmailTemplateModelTestItem();
     $model->string = 'abc';
     $model->firstName = 'James';
     $model->lastName = 'Jackson';
     $model->phone = 1122334455;
     $model->boolean = true;
     $model->date = '2008-12-31';
     $model->dateTime = '2008-12-31 07:48:04';
     $model->textArea = 'Multiple Lines\\nOf Text';
     $model->url = 'http://www.zurmo.com/';
     $model->integer = 999;
     $model->float = 999.999;
     $model->currencyValue = $currencyValue1;
     $model->dropDown->value = "DropdownSelectedValue";
     $model->radioDropDown->value = "RadioDropdownSelectedValue";
     $model->primaryEmail = $primaryEmail1;
     $model->secondaryEmail = $secondaryEmail1;
     $model->primaryAddress = $address1;
     $model->likeContactState = $likeContactState1;
     $model->user = $user1;
     $model->multiDropDown->data = $multiDropDownCustomFieldData1;
     $model->tagCloud->data = $tagCustomFieldData1;
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue1);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue2);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue3);
     $model->tagCloud->values->add($tagCustomFieldValue1);
     $model->tagCloud->values->add($tagCustomFieldValue2);
     $model->customCstm = 'text custom';
     $saved = $model->save();
     assert('$saved');
     // Not Coding Standard
     self::$emailTemplate = $model;
     // Update all values but do not save the model.
     $multiDropDownCustomFieldData2 = new CustomFieldData();
     $multiDropDownCustomFieldData2->name = 'multiDropDown2';
     $multiDropDownCustomFieldData2->serializedData = serialize(array('Thirteen', 14, 'XV'));
     $saved = $multiDropDownCustomFieldData2->save();
     assert('$saved');
     // Not Coding Standard
     $multiDropDownCustomFieldValue4 = new CustomFieldValue();
     $multiDropDownCustomFieldValue4->value = 'Thirteen';
     $multiDropDownCustomFieldValue5 = new CustomFieldValue();
     $multiDropDownCustomFieldValue5->value = 14;
     $multiDropDownCustomFieldValue6 = new CustomFieldValue();
     $multiDropDownCustomFieldValue6->value = 'XV';
     $tagCustomFieldData2 = new CustomFieldData();
     $tagCustomFieldData2->name = 'tagCloud2';
     $tagCustomFieldData2->serializedData = serialize(array('Nginx', 'Python'));
     $saved = $tagCustomFieldData2->save();
     assert('$saved');
     // Not Coding Standard
     $tagCustomFieldValue3 = new CustomFieldValue();
     $tagCustomFieldValue3->value = 'Python';
     $tagCustomFieldValue4 = new CustomFieldValue();
     $tagCustomFieldValue4->value = 'Nginx';
     self::$emailTemplate->string = 'def';
     self::$emailTemplate->firstName = 'Jane';
     self::$emailTemplate->lastName = 'Bond';
     self::$emailTemplate->phone = 66778899;
     self::$emailTemplate->boolean = false;
     self::$emailTemplate->date = '2009-12-31';
     self::$emailTemplate->dateTime = '2009-12-31 07:48:04';
     self::$emailTemplate->textArea = 'Multiple Lines\\nOf\\nText';
     self::$emailTemplate->url = 'http://www.zurmo.org/';
     self::$emailTemplate->integer = 888;
     self::$emailTemplate->float = 888.888;
     self::$emailTemplate->currencyValue->value = 99;
     self::$emailTemplate->dropDown->value = "DropdownSelectedVal";
     self::$emailTemplate->radioDropDown->value = "RadioDropdownSelectedVal";
     self::$emailTemplate->primaryEmail->emailAddress = "*****@*****.**";
     self::$emailTemplate->primaryEmail->isInvalid = false;
     self::$emailTemplate->primaryEmail->optOut = true;
     self::$emailTemplate->secondaryEmail->emailAddress = "*****@*****.**";
     self::$emailTemplate->secondaryEmail->isInvalid = true;
     self::$emailTemplate->secondaryEmail->optOut = false;
     self::$emailTemplate->primaryAddress->street1 = "SomeOtherStreet1";
     self::$emailTemplate->primaryAddress->street2 = "SomeOtherStreet2";
     self::$emailTemplate->primaryAddress->city = "SomeOtherCity";
     self::$emailTemplate->primaryAddress->state = "SomeOtherState";
     self::$emailTemplate->primaryAddress->postalCode = 2222;
     self::$emailTemplate->primaryAddress->country = "SomeOtherCountry";
     self::$emailTemplate->likeContactState->name = 'New';
     self::$emailTemplate->likeContactState->order = 1;
     self::$emailTemplate->user->lastName = 'Dean';
     self::$emailTemplate->user->hash = 'teo8eghaipaC5ahngahleiyaebofu6oo';
     self::$emailTemplate->user->language = 'en';
     self::$emailTemplate->user->timeZone = 'America/Denver';
     self::$emailTemplate->user->username = '******';
     self::$emailTemplate->multiDropDown->data = $multiDropDownCustomFieldData2;
     self::$emailTemplate->multiDropDown->values->remove($multiDropDownCustomFieldValue1);
     self::$emailTemplate->multiDropDown->values->remove($multiDropDownCustomFieldValue2);
     self::$emailTemplate->multiDropDown->values->remove($multiDropDownCustomFieldValue3);
     self::$emailTemplate->multiDropDown->values->add($multiDropDownCustomFieldValue4);
     self::$emailTemplate->multiDropDown->values->add($multiDropDownCustomFieldValue5);
     self::$emailTemplate->multiDropDown->values->add($multiDropDownCustomFieldValue6);
     self::$emailTemplate->tagCloud->data = $tagCustomFieldData2;
     self::$emailTemplate->tagCloud->values->remove($tagCustomFieldValue1);
     self::$emailTemplate->tagCloud->values->remove($tagCustomFieldValue2);
     self::$emailTemplate->tagCloud->values->add($tagCustomFieldValue3);
     self::$emailTemplate->tagCloud->values->add($tagCustomFieldValue4);
     self::$emailTemplate->customCstm = 'text custom changed';
     self::$content = 'Current: [[STRING]] [[FIRST^NAME]] [[LAST^NAME]] ' . '[[PHONE]] Old: [[WAS%STRING]] [[WAS%FIRST^NAME]] ' . '[[WAS%LAST^NAME]] [[WAS%PHONE]]';
     self::$compareContent = 'Current: def Jane Bond 66778899 Old: abc James ' . 'Jackson 1122334455';
 }
    public static function setUpBeforeClass()
    {
        parent::setUpBeforeClass();
        SecurityTestHelper::createSuperAdmin();
        SecurityTestHelper::createUsers();
        // Begin Not Coding Standard
        static::$textBody = <<<TXT
Delivered-To: shoaibi@bitesource.com
Received: by 10.49.61.161 with SMTP id q1csp63838qer;
Thu, 6 Jun 2013 10:16:54 -0700 (PDT)
X-Received: by 10.182.220.161 with SMTP id px1mr18728348obc.82.1370539014529;
Thu, 06 Jun 2013 10:16:54 -0700 (PDT)
Return-Path: <>
Received: from blu0-omc4-s25.blu0.hotmail.com (blu0-omc4-s25.blu0.hotmail.com. [65.55.111.164])
by mx.google.com with ESMTP id gp5si32927488obb.72.2013.06.06.10.16.54
for <*****@*****.**>;
Thu, 06 Jun 2013 10:16:54 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of blu0-omc4-s25.blu0.hotmail.com designates 65.55.111.164 as permitted sender) client-ip=65.55.111.164;
Authentication-Results: mx.google.com;
spf=pass (google.com: best guess record for domain of blu0-omc4-s25.blu0.hotmail.com designates 65.55.111.164 as permitted sender) smtp.mail=
Received: from BAY0-MC1-F47.Bay0.hotmail.com ([65.55.111.137]) by blu0-omc4-s25.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675);
Thu, 6 Jun 2013 10:16:54 -0700
From: postmaster@hotmail.com
To: shoaibi@bitesource.com
Date: Thu, 6 Jun 2013 10:16:51 -0700
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="9B095B5ADSN=_01CE585A42E11DFD00CA0E30BAY0?MC1?F47.Bay"
X-DSNContext: 335a7efd - 4480 - 00000001 - 80040546
Message-ID: <*****@*****.**>
Subject: Delivery Status Notification (Failure)
Return-Path: <>
X-OriginalArrivalTime: 06 Jun 2013 17:16:54.0590 (UTC) FILETIME=[A4660DE0:01CE62D9]

This is a MIME-formatted message.
Portions of this message may be unreadable without a MIME-capable mail program.

--9B095B5ADSN=_01CE585A42E11DFD00CA0E30BAY0?MC1?F47.Bay
Content-Type: text/plain; charset=unicode-1-1-utf-7

This is an automatically generated Delivery Status Notification.

Delivery to the following recipients failed.
noreply@live.com

--9B095B5ADSN=_01CE585A42E11DFD00CA0E30BAY0?MC1?F47.Bay
Content-Type: message/delivery-status

Reporting-MTA: dns;BAY0-MC1-F47.Bay0.hotmail.com
Received-From-MTA: dns;mail-qa0-f52.google.com
Arrival-Date: Thu, 6 Jun 2013 10:16:51 -0700

Final-Recipient: rfc822;noreply@live.com
Action: failed
Status: 5.5.0
Diagnostic-Code: smtp;550 Requested action not taken: mailbox unavailable (1998570073:3844:-2147467259)

--9B095B5ADSN=_01CE585A42E11DFD00CA0E30BAY0?MC1?F47.Bay
Content-Type: message/rfc822

Received: from mail-qa0-f52.google.com ([209.85.216.52]) by BAY0-MC1-F47.Bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4900);
Thu, 6 Jun 2013 10:16:51 -0700
Received: by mail-qa0-f52.google.com with SMTP id bv4so464319qab.11
for <*****@*****.**>; Thu, 06 Jun 2013 10:16:51 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20120113;
h=mime-version:sender:x-originating-ip:from:date:x-google-sender-auth
:message-id:subject:to:content-type:x-gm-message-state;
bh=2m+eb+RDLDCSBrp+GNlyBgkKXcRcSbXOq+td+E4B/vU=;
b=e7tOBRR+XxPUNKw/d5sfu1gJcGjnPI1gjNKK/08DKvZQmJXbvbY7rgQ4A5Z+lkFMNp
bxhQlINGUWkZW2+LKKI3W2EX8nXhgBykospUx6W/846jaM1xgKZ57jhmCsklDuARqL1/
DrtydznBtoBNHthwUjqfG+sohPtTyERiSLD8B1sWB3qqXrAh6VXupsbhoPbrjC3D57EB
Ga1gwqduHXx/KxrDOiy3Xts3N8dN8lYLD0CgEGJWV/qHvfV1A9z+gDyV3QfNn0Ncdbgl
2Y7vXIlTsHkNkHV9Uy75LqtQ3ZTjtgaB7nVo2NRMW9DdVYp9bVoQ2QJCvpwmPdanJqct
M8iQ==
X-Received: by 10.229.17.10 with SMTP id q10mr14191772qca.21.1370539011681;
Thu, 06 Jun 2013 10:16:51 -0700 (PDT)
MIME-Version: 1.0
Sender: shoaibi@bitesource.com
Received: by 10.49.61.161 with HTTP; Thu, 6 Jun 2013 10:16:36 -0700 (PDT)
X-Originating-IP: [182.188.197.11]
From: Shoaibi <*****@*****.**>
Date: Thu, 6 Jun 2013 22:16:36 +0500
X-Google-Sender-Auth: KOGyLSQUS92LYi12duzB4F5GulU
Message-ID: <*****@*****.**>
Subject: bounce live
To: noreply@live.com
Content-Type: multipart/alternative; boundary=0015175cf92af15c9c04de7f7a48
X-Gm-Message-State: ALoCoQli+Q4i33Aqqp0RpAsEI8VLEVW3dnQQSMlMNMnIOq5PPSDv/+h73IEf/OU4Slm4LO4T9Z6F
Return-Path: shoaibi@bitesource.com
X-OriginalArrivalTime: 06 Jun 2013 17:16:51.0751 (UTC) FILETIME=[A2B4DB70:01CE62D9]
zurmoPersonId: 20
zurmoItemClass: AutoresponderItem
zurmoItemId: 10
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - host4.zurmo.com
X-AntiAbuse: Original Domain - bitesource.com
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - testmail.zurmo.com
X-Get-Message-Sender-Via: host4.zurmo.com: authenticated_id: dropbox_shoaibi@testmail.zurmo.com
X-Source:
X-Source-Args:
X-Source-Dir:

--0015175cf92af15c9c04de7f7a48
Content-Type: text/plain; charset=UTF-8

sfasdasdsadsadas

--0015175cf92af15c9c04de7f7a48
Content-Type: text/html; charset=UTF-8

<div dir="ltr">sfasdasdsadsadas</div>
--0015175cf92af15c9c04de7f7a48--
--9B095B5ADSN=_01CE585A42E11DFD00CA0E30BAY0?MC1?F47.Bay--
TXT;
        // End Not Coding Standard
    }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     self::$super = User::getByUsername('super');
     Yii::app()->user->userModel = self::$super;
     $loaded = ContactsModule::loadStartingData();
     if (!$loaded) {
         throw new NotSupportedException();
     }
     $emailSignature = new EmailSignature();
     $emailSignature->htmlContent = 'my email signature';
     self::$super->emailSignatures->add($emailSignature);
     self::$super->save();
     $currencies = Currency::getAll();
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 100;
     $currencyValue->currency = $currencies[0];
     $multiDropDownCustomFieldData = new CustomFieldData();
     $multiDropDownCustomFieldData->name = 'multiDropDown';
     $multiDropDownCustomFieldData->serializedData = serialize(array('Ten', 11, 'XII'));
     $saved = $multiDropDownCustomFieldData->save();
     assert('$saved');
     // Not Coding Standard
     $multiDropDownCustomFieldValue1 = new CustomFieldValue();
     $multiDropDownCustomFieldValue1->value = 'Ten';
     $multiDropDownCustomFieldValue2 = new CustomFieldValue();
     $multiDropDownCustomFieldValue2->value = 11;
     $multiDropDownCustomFieldValue3 = new CustomFieldValue();
     $multiDropDownCustomFieldValue3->value = 'XII';
     $tagCustomFieldData = new CustomFieldData();
     $tagCustomFieldData->name = 'tagCloud';
     $tagCustomFieldData->serializedData = serialize(array('Apache', 'PHP'));
     $saved = $tagCustomFieldData->save();
     assert('$saved');
     // Not Coding Standard
     $tagCustomFieldValue1 = new CustomFieldValue();
     $tagCustomFieldValue1->value = 'PHP';
     $tagCustomFieldValue2 = new CustomFieldValue();
     $tagCustomFieldValue2->value = 'Apache';
     $primaryEmail = new Email();
     $primaryEmail->emailAddress = "*****@*****.**";
     $primaryEmail->isInvalid = true;
     $primaryEmail->optOut = false;
     $secondaryEmail = new Email();
     $secondaryEmail->emailAddress = "*****@*****.**";
     $secondaryEmail->isInvalid = false;
     $secondaryEmail->optOut = true;
     $address = new Address();
     $address->street1 = "SomeStreet1";
     $address->street2 = "SomeStreet2";
     $address->city = "SomeCity";
     $address->state = "SomeState";
     $address->postalCode = 1111;
     $address->country = "SomeCountry";
     $likeContactState = new ContactState();
     $likeContactState->name = 'Customer';
     $likeContactState->order = 0;
     static::$hash = StringUtil::generateRandomString(60);
     $users = User::getAll();
     $user = new User();
     $user->lastName = 'Kevin';
     $user->hash = static::$hash;
     $user->language = 'es';
     $user->timeZone = 'America/Chicago';
     $user->username = '******';
     $user->currency = $currencies[0];
     $user->manager = $users[0];
     //Custom attribute
     $attributeForm = new TextAttributeForm();
     $attributeForm->attributeName = 'custom';
     $attributeForm->attributeLabels = array('en' => 'test label en');
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new EmailTemplateModelTestItem());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     //Custom attribute with underscore and number
     $attributeForm = new TextAttributeForm();
     $attributeForm->attributeName = 'custom_attr_2';
     $attributeForm->attributeLabels = array('en' => 'custom test label en');
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new EmailTemplateModelTestItem());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $model = new EmailTemplateModelTestItem();
     $model->string = 'We will add a $100 discount to this deal';
     $model->firstName = 'James';
     $model->lastName = 'Jackson';
     $model->phone = 1122334455;
     $model->boolean = true;
     $model->date = '2008-12-31';
     $model->dateTime = '2008-12-31 07:48:04';
     $model->textArea = 'Multiple Lines\\nOf Text';
     $model->url = 'http://www.zurmo.com/';
     $model->integer = 999;
     $model->float = 999.999;
     $model->currencyValue = $currencyValue;
     $model->dropDown->value = "DropdownSelectedValue";
     $model->radioDropDown->value = "RadioDropdownSelectedValue";
     $model->primaryEmail = $primaryEmail;
     $model->secondaryEmail = $secondaryEmail;
     $model->primaryAddress = $address;
     $model->likeContactState = $likeContactState;
     $model->user = $user;
     $model->multiDropDown->data = $multiDropDownCustomFieldData;
     $model->tagCloud->data = $tagCustomFieldData;
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue1);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue2);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue3);
     $model->tagCloud->values->add($tagCustomFieldValue1);
     $model->tagCloud->values->add($tagCustomFieldValue2);
     $model->customCstm = 'text custom';
     $model->custom_attr_2Cstm = 'text custom 2';
     $saved = $model->save();
     assert('$saved');
     // Not Coding Standard
     self::$emailTemplate = $model;
     self::$content = '[[STRING]] [[FIRST^NAME]] [[LAST^NAME]] [[PHONE]]';
     self::$compareContent = 'We will add a $100 discount to this deal' . ' James Jackson 1122334455';
     self::$account = AccountTestHelper::createAccountByNameForOwner('Account1', self::$super);
     self::$account->billingAddress = new Address();
     self::$account->billingAddress->street1 = 'AccountStreet1';
     $saved = self::$account->save();
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     self::$contact = ContactTestHelper::createContactWithAccountByNameForOwner('Jason', self::$super, self::$account);
     self::$lead = LeadTestHelper::createLeadByNameForOwner('Laura', self::$super);
 }