public function teardown()
 {
     if ($this->freeze) {
         RedBeanDatabase::freeze();
     }
     parent::teardown();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ContactsModule::loadStartingData();
     $bobbyBoss = UserTestHelper::createBasicUserWithEmailAddress('bobbyBoss');
     $sarahBoss = UserTestHelper::createBasicUserWithEmailAddress('sarahBoss');
     $superBoss = UserTestHelper::createBasicUserWithEmailAddress('superBoss');
     $super = User::getByUsername('super');
     $super->primaryEmail = new Email();
     $super->primaryEmail->emailAddress = '*****@*****.**';
     $super->manager = $superBoss;
     assert($super->save());
     // Not Coding Standard
     $bobby = UserTestHelper::createBasicUserWithEmailAddress('bobby');
     $bobby->manager = $bobbyBoss;
     assert($bobby->save());
     // Not Coding Standard
     $sarah = UserTestHelper::createBasicUserWithEmailAddress('sarah');
     $sarah->manager = $sarahBoss;
     assert($sarah->save());
     // Not Coding Standard
     self::$superUserId = $super->id;
     self::$bobbyUserId = $bobby->id;
     self::$sarahUserId = $sarah->id;
     self::$superBossUserId = $superBoss->id;
     self::$bobbyBossUserId = $bobbyBoss->id;
     self::$sarahBossUserId = $sarahBoss->id;
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = User::getByUsername('super');
     $bobby = UserTestHelper::createBasicUser('bobby');
     $sarah = UserTestHelper::createBasicUser('sarah');
     self::$superUserId = $super->id;
     self::$bobbyUserId = $bobby->id;
     self::$sarahUserId = $sarah->id;
     $currency = Currency::makeBaseCurrency();
     assert($currency->code == 'USD');
     // Not Coding Standard
     self::$baseCurrencyId = $currency->id;
     $currency = new Currency();
     $currency->code = 'EUR';
     $currency->rateToBase = 2;
     assert($currency->save());
     // Not Coding Standard
     self::$eurCurrencyId = $currency->id;
     $values = array('A1', 'B2', 'C3', 'D4', 'E5', 'F6');
     $fieldData = CustomFieldData::getByName('WorkflowTestDropDown');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('A1', 'B2', 'C3', 'D4', 'E5', 'F6');
     $fieldData = CustomFieldData::getByName('WorkflowTestRadioDropDown');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('M1', 'M2', 'M3', 'M4', 'M5', 'M6');
     $fieldData = CustomFieldData::getByName('WorkflowTestMultiDropDown');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('M1', 'M2', 'M3', 'M4', 'M5', 'M6');
     $fieldData = CustomFieldData::getByName('WorkflowTestTagCloud');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $loaded = ContactsModule::loadStartingData();
     assert($loaded);
     // Not Coding Standard
     $contactStates = ContactState::getByName('New');
     self::$newState = $contactStates[0];
     $contactStates = ContactState::getByName('In progress');
     self::$inProgressState = $contactStates[0];
     self::$groupTest = new Group();
     self::$groupTest->name = 'test';
     $saved = self::$groupTest->save();
     assert($saved);
     // Not Coding Standard
     $group = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $saved = $group->save();
     assert($saved);
     // Not Coding Standard
 }
Esempio n. 4
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ContactsModule::loadStartingData();
     UserTestHelper::createBasicUser('bobby');
     Currency::getAll();
     //Ensure USD is present
 }
Esempio n. 5
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     UserTestHelper::createBasicUser('nobody');
     $somebody = UserTestHelper::createBasicUser('somebody');
     $somebody->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
     $somebody->setRight('AccountsModule', AccountsModule::RIGHT_CREATE_ACCOUNTS);
     assert($somebody->save());
     // Not Coding Standard
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = User::getByUsername('super');
     $bobby = UserTestHelper::createBasicUser('bobby');
     $sarah = UserTestHelper::createBasicUser('sarah');
     self::$superUserId = $super->id;
     self::$bobbyUserId = $bobby->id;
     self::$sarahUserId = $sarah->id;
     $marketingList = MarketingListTestHelper::createMarketingListByName('testList');
     self::$marketingListId = $marketingList->id;
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $attributeName = 'calculated';
     $attributeForm = new CalculatedNumberAttributeForm();
     $attributeForm->attributeName = $attributeName;
     $attributeForm->attributeLabels = array('en' => 'Test Calculated');
     $attributeForm->formula = 'integer + float';
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new WorkflowModelTestItem());
     $adapter->setAttributeMetadataFromForm($attributeForm);
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = User::getByUsername('super');
     $super = User::getByUsername('super');
     $super->primaryEmail = new Email();
     $super->primaryEmail->emailAddress = '*****@*****.**';
     assert($super->save());
     // Not Coding Standard
     //Create alpha group
     $group = new Group();
     $group->name = 'Alpha';
     $saved = $group->save();
     assert($saved);
     // Not Coding Standard
     self::$alphaGroup = $group;
     //Now set default permissions to owner and users in group Alpha
     $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($super);
     $form->defaultPermissionSetting = UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP;
     $form->defaultPermissionGroupSetting = $group->id;
     UserConfigurationFormAdapter::setConfigurationFromForm($form, $super);
     $bobby = UserTestHelper::createBasicUserWithEmailAddress('bobby');
     $sarah = UserTestHelper::createBasicUserWithEmailAddress('sarah');
     self::$superUserId = $super->id;
     self::$bobbyUserId = $bobby->id;
     self::$sarahUserId = $sarah->id;
     $file = ZurmoTestHelper::createFileModel();
     $emailTemplate = new EmailTemplate();
     $emailTemplate->builtType = EmailTemplate::BUILT_TYPE_PASTED_HTML;
     $emailTemplate->modelClassName = 'WorkflowModelTestItem';
     $emailTemplate->type = 1;
     $emailTemplate->name = 'some template';
     $emailTemplate->subject = 'some subject [[LAST^NAME]]';
     $emailTemplate->htmlContent = 'html content [[STRING]]';
     $emailTemplate->textContent = 'text content [[PHONE]]';
     $emailTemplate->files->add($file);
     $saved = $emailTemplate->save();
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     self::$emailTemplate = $emailTemplate;
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     assert($everyoneGroup->save());
     // Not Coding Standard
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = User::getByUsername('super');
     $super->primaryEmail = new Email();
     $super->primaryEmail->emailAddress = '*****@*****.**';
     assert($super->save());
     // Not Coding Standard
     $bobby = UserTestHelper::createBasicUserWithEmailAddress('bobby');
     $sarah = UserTestHelper::createBasicUserWithEmailAddress('sarah');
     $jimmy = UserTestHelper::createBasicUserWithEmailAddress('jimmy');
     $jimmy2 = UserTestHelper::createBasicUserWithEmailAddress('jimmy2');
     $jimmy3 = UserTestHelper::createBasicUserWithEmailAddress('jimmy3');
     self::$super = $super;
     self::$bobby = $bobby;
     self::$sarah = $sarah;
     self::$jimmy = $jimmy;
     self::$jimmy2 = $jimmy2;
     self::$jimmy3 = $jimmy3;
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ContactsModule::loadStartingData();
     $super = User::getByUsername('super');
     $super->primaryEmail = new Email();
     $super->primaryEmail->emailAddress = '*****@*****.**';
     assert($super->save());
     // Not Coding Standard
     $savedWorkflow = new SavedWorkflow();
     $savedWorkflow->name = 'some workflow';
     $savedWorkflow->description = 'description';
     $savedWorkflow->moduleClassName = 'moduleClassName';
     $savedWorkflow->triggerOn = Workflow::TRIGGER_ON_NEW;
     $savedWorkflow->type = 'some type';
     $savedWorkflow->serializedData = serialize(array('something'));
     $saved = $savedWorkflow->save();
     assert($saved);
     // Not Coding Standard
     self::$savedWorkflow = $savedWorkflow;
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $savedWorkflow = new SavedWorkflow();
     $savedWorkflow->name = 'some workflow';
     $savedWorkflow->description = 'description';
     $savedWorkflow->moduleClassName = 'moduleClassName';
     $savedWorkflow->triggerOn = Workflow::TRIGGER_ON_NEW;
     $savedWorkflow->type = 'some type';
     $savedWorkflow->serializedData = serialize(array('something'));
     $saved = $savedWorkflow->save();
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     self::$savedWorkflow = $savedWorkflow;
     $model = new WorkflowModelTestItem();
     $model->lastName = 'Green';
     $model->string = 'string';
     $saved = $model->save();
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     self::$testModel = $model;
 }
 public function setUp()
 {
     parent::setUp();
     Yii::app()->user->userModel->primaryEmail->emailAddress = '*****@*****.**';
 }
 public function setUp()
 {
     parent::setUp();
     Yii::app()->user->userModel = User::getByUsername('super');
 }