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();
     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);
 }