Пример #1
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     UserTestHelper::createBasicUser('billy');
     UserTestHelper::createBasicUser('sally');
 }
Пример #2
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $user = SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = $user;
     $loaded = ContactsModule::loadStartingData();
     assert($loaded);
     // Not Coding Standard
     $contactData = array('Sam', 'Sally', 'Sarah', 'Jason', 'James', 'Roger');
     $contactStates = ContactState::getAll();
     $lastContactState = $contactStates[count($contactStates) - 1];
     foreach ($contactData as $key => $firstName) {
         $contact = new Contact();
         $contact->title->value = 'Mr.';
         $contact->firstName = $firstName;
         $contact->lastName = $firstName . 'son';
         $contact->owner = $user;
         $contact->state = $lastContactState;
         $contact->primaryEmail = new Email();
         $contact->primaryEmail->emailAddress = $key . '@zurmoland.com';
         $contact->secondaryEmail = new Email();
         $contact->secondaryEmail->emailAddress = 'a' . $key . $firstName . '@zurmoworld.com';
         assert($contact->save());
         // Not Coding Standard
     }
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ContactsModule::loadStartingData();
     SecurityTestHelper::createSuperAdmin();
     $sally = UserTestHelper::createBasicUser('sally');
     $sally->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
     $sally->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
     $sally->setRight('MeetingsModule', MeetingsModule::RIGHT_ACCESS_MEETINGS);
     $sally->setRight('OpportunitiesModule', OpportunitiesModule::RIGHT_ACCESS_OPPORTUNITIES);
     $sally->setRight('ReportsTestModule', ReportsTestModule::RIGHT_ACCESS_REPORTS_TESTS);
     if (!$sally->save()) {
         throw new FailedToSaveModelException();
     }
     $sarah = UserTestHelper::createBasicUser('sarah');
     $sarah->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
     $sarah->setRight('LeadsModule', LeadsModule::RIGHT_ACCESS_LEADS);
     $sarah->setRight('MeetingsModule', MeetingsModule::RIGHT_ACCESS_MEETINGS);
     $sarah->setRight('OpportunitiesModule', OpportunitiesModule::RIGHT_ACCESS_OPPORTUNITIES);
     $sarah->setRight('ReportsTestModule', ReportsTestModule::RIGHT_ACCESS_REPORTS_TESTS);
     if (!$sarah->save()) {
         throw new FailedToSaveModelException();
     }
     $nobody = UserTestHelper::createBasicUser('nobody');
     if (!$nobody->save()) {
         throw new FailedToSaveModelException();
     }
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     UserTestHelper::createBasicUser('normal');
     $emailBox = EmailBoxUtil::getDefaultEmailBoxByUser(User::getByUsername('super'));
 }
Пример #5
0
 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();
     AllPermissionsOptimizationUtil::rebuild();
     SecurityTestHelper::createSuperAdmin();
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     assert($everyoneGroup->save());
     // Not Coding Standard
     $group1 = new Group();
     $group1->name = 'Group1';
     assert($group1->save());
     // Not Coding Standard
     $group2 = new Group();
     $group2->name = 'Group2';
     assert($group2->save());
     // Not Coding Standard
     $group3 = new Group();
     $group3->name = 'Group3';
     assert($group3->save());
     // Not Coding Standard
     $group4 = new Group();
     $group4->name = 'Group4';
     assert($group4->save());
     // Not Coding Standard
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SavedReportTestHelper::makeSummationWithDrillDownReport();
     SavedReportTestHelper::makeSimpleContactRowsAndColumnsReport();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $user1 = new User();
     $user1->username = '******';
     $user1->firstName = 'abel';
     $user1->lastName = 'zitabina';
     $user1->setPassword('myuser');
     $user1->save();
     $user2 = new User();
     $user2->username = '******';
     $user2->firstName = 'zitabina';
     $user2->lastName = 'abel';
     $user2->setPassword('myuser');
     $user2->save();
     $user3 = new User();
     $user3->username = '******';
     $user3->firstName = 'abel';
     $user3->lastName = 'abel';
     $user3->setPassword('myuser');
     $user3->save();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     AllPermissionsOptimizationUtil::rebuild();
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $everyoneGroup->save();
     $super = User::getByUsername('super');
     //Steven have access to missions module
     $steven = UserTestHelper::createBasicUser('steven');
     $steven->setRight('MissionsModule', MissionsModule::RIGHT_ACCESS_MISSIONS);
     $steven->save();
     //Jack dont have acess to missions module
     $jack = UserTestHelper::createBasicUser('jack');
     $mission = new Mission();
     $mission->owner = $super;
     $mission->takenByUser = $steven;
     $mission->description = 'My test description';
     $mission->reward = 'My test reward';
     $mission->status = Mission::STATUS_AVAILABLE;
     $mission->addPermissions($everyoneGroup, Permission::READ_WRITE);
     assert($mission->save());
     // Not Coding Standard
     AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($mission, $everyoneGroup);
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $billy = UserTestHelper::createBasicUser('billy');
     EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     AllPermissionsOptimizationUtil::rebuild();
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
 }
Пример #13
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     self::$marketingList = MarketingListTestHelper::createMarketingListByName('a new list');
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = $super;
     AccountTestHelper::createAccountByNameForOwner('anAccount', $super);
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $user = UserTestHelper::createBasicUser('steve');
     $user->primaryEmail->emailAddress = '*****@*****.**';
     $user->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
     assert($user->save());
     // Not Coding Standard
     $contact1 = ContactTestHelper::createContactByNameForOwner('peter', $user);
     $contact1->primaryEmail->emailAddress = '*****@*****.**';
     $contact1->secondaryEmail->emailAddress = '*****@*****.**';
     assert($contact1->save());
     // Not Coding Standard
     $contactsOrLeads = ContactSearch::getContactsByAnyEmailAddress('*****@*****.**', null, null);
     $contact2 = ContactTestHelper::createContactByNameForOwner('jim', $user);
     $contact2->primaryEmail->emailAddress = '*****@*****.**';
     assert($contact2->save());
     // Not Coding Standard
     $nonExistingUserEmail = '*****@*****.**';
     self::$user = $user;
     self::$contact1 = $contact1;
     self::$contact2 = $contact2;
     self::$nonExistingUserEmail = $nonExistingUserEmail;
     Yii::app()->imap->imapUsername = '******';
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     ContactsModule::loadStartingData();
     //Need to instantiate a controller so the clipWidget can work properly in elements that utilize it.
     $controller = Yii::app()->createController('reports/default');
     list($controller, $actionId) = $controller;
     Yii::app()->setController($controller);
     $values = array('Test1', 'Test2', 'Test3', 'Sample', 'Demo');
     $customFieldData = CustomFieldData::getByName('ReportTestDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Multi 1', 'Multi 2', 'Multi 3');
     $customFieldData = CustomFieldData::getByName('ReportTestMultiDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Radio 1', 'Radio 2', 'Radio 3');
     $customFieldData = CustomFieldData::getByName('ReportTestRadioDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Cloud 1', 'Cloud 2', 'Cloud 3');
     $customFieldData = CustomFieldData::getByName('ReportTestTagCloud');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
 }
Пример #17
0
 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();
     UserTestHelper::createBasicUser('billy');
     UserTestHelper::createBasicUser('jane');
     $someoneSuper = UserTestHelper::createBasicUser('someoneSuper');
     $group = Group::getByName('Super Administrators');
     $group->users->add($someoneSuper);
     $saved = $group->save();
     assert($saved);
     // Not Coding Standard
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     SendGrid::register_autoloader();
     Smtpapi::register_autoloader();
     if (SendGridTestHelper::isSetSendGridAccountTestConfiguration()) {
         Yii::app()->sendGridEmailHelper->apiUsername = Yii::app()->params['emailTestAccounts']['sendGridGlobalSettings']['apiUsername'];
         Yii::app()->sendGridEmailHelper->apiPassword = Yii::app()->params['emailTestAccounts']['sendGridGlobalSettings']['apiPassword'];
         Yii::app()->sendGridEmailHelper->setApiSettings();
         Yii::app()->sendGridEmailHelper->init();
         static::$testEmailAddress = Yii::app()->params['emailTestAccounts']['testEmailAddress'];
     }
     // 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();
     $super = User::getByUsername('super');
     $super->primaryEmail->emailAddress = '*****@*****.**';
     $saved = $super->save();
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     MarketingListTestHelper::createMarketingListByName('testMarketingList');
     $campaign = CampaignTestHelper::createCampaign('testCampaign', 'testSubject', 'testContent');
     $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();
     }
     ReadPermissionsOptimizationUtil::rebuild();
 }
Пример #20
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = SecurityTestHelper::createSuperAdmin();
     // Delete item from jobQueue, that is created when new user is created
     Yii::app()->jobQueue->deleteAll();
 }
Пример #21
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     AccountTestHelper::createAccountByNameForOwner('anAccount', $super);
 }
Пример #22
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $everyoneGroup->save();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     self::$emailHelperSendEmailThroughTransport = Yii::app()->emailHelper->sendEmailThroughTransport;
     static::$userpsg = UserTestHelper::createBasicUser('userpsg');
     static::$usercstmsmtp = UserTestHelper::createBasicUser('usercstmsmtp');
     static::$basicuser = UserTestHelper::createBasicUser('basicuser');
     static::$bothSGandCstmUser = UserTestHelper::createBasicUser('bothSGandCstmUser');
     $someoneSuper = UserTestHelper::createBasicUser('someoneSuper');
     $group = Group::getByName('Super Administrators');
     $group->users->add($someoneSuper);
     $saved = $group->save();
     assert($saved);
     // Not Coding Standard
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     if (EmailMessageTestHelper::isSetEmailAccountsTestConfiguration()) {
         EmailMessageTestHelper::createEmailAccountForMailerFactory(static::$usercstmsmtp);
         EmailMessageTestHelper::createEmailAccountForMailerFactory(static::$bothSGandCstmUser);
     }
     SendGrid::register_autoloader();
     Smtpapi::register_autoloader();
     if (SendGridTestHelper::isSetSendGridAccountTestConfiguration()) {
         SendGridTestHelper::createSendGridEmailAccount(static::$userpsg);
         SendGridTestHelper::createSendGridEmailAccount(static::$bothSGandCstmUser);
         Yii::app()->sendGridEmailHelper->apiUsername = Yii::app()->params['emailTestAccounts']['sendGridGlobalSettings']['apiUsername'];
         Yii::app()->sendGridEmailHelper->apiPassword = Yii::app()->params['emailTestAccounts']['sendGridGlobalSettings']['apiPassword'];
         Yii::app()->sendGridEmailHelper->setApiSettings();
         Yii::app()->sendGridEmailHelper->init();
     }
     // Delete item from jobQueue, that is created when new user is created
     Yii::app()->jobQueue->deleteAll();
 }
Пример #24
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
     Yii::app()->user->userModel = SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = SecurityTestHelper::createSuperAdmin();
     $super->primaryEmail->emailAddress = '*****@*****.**';
     $super->save();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
     $super = SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = User::getByUsername('super');
     $headquarters = AccountTestHelper::createAccountByNameForOwner('Headquarters', $super);
     $division1 = AccountTestHelper::createAccountByNameForOwner('Division1', $super);
     $division2 = AccountTestHelper::createAccountByNameForOwner('Division2', $super);
     $ceo = ContactTestHelper::createContactWithAccountByNameForOwner('ceo', $super, $headquarters);
     $div1President = ContactTestHelper::createContactWithAccountByNameForOwner('div1 President', $super, $division1);
     $div2President = ContactTestHelper::createContactWithAccountByNameForOwner('div2 President', $super, $division2);
     $opportunity = OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('big opp', $super, $headquarters);
     $opportunityDiv1 = OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('div1 small opp', $super, $division1);
     $opportunityDiv2 = OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('div2 small opp', $super, $division2);
     //attach divisions to headquarters
     $headquarters->accounts->add($division1);
     $headquarters->accounts->add($division2);
     assert($headquarters->save());
     // Not Coding Standard
     //attach opportunities to contacts
     $opportunity->contacts->add($ceo);
     assert($opportunity->save());
     // Not Coding Standard
     //Forget models to ensure relations are known on the next retrieval
     $headquarters->forget();
     $division1->forget();
     $division2->forget();
     $ceo->forget();
 }
Пример #28
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     self::$emailHelperSendEmailThroughTransport = Yii::app()->emailHelper->sendEmailThroughTransport;
     UserTestHelper::createBasicUser('billy');
     UserTestHelper::createBasicUser('jane');
     $someoneSuper = UserTestHelper::createBasicUser('someoneSuper');
     $group = Group::getByName('Super Administrators');
     $group->users->add($someoneSuper);
     $saved = $group->save();
     assert($saved);
     // Not Coding Standard
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     if (EmailMessageTestHelper::isSetEmailAccountsTestConfiguration()) {
         $steve = UserTestHelper::createBasicUser('steve');
         EmailMessageTestHelper::createEmailAccount($steve);
         Yii::app()->imap->imapHost = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapHost'];
         Yii::app()->imap->imapUsername = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapUsername'];
         Yii::app()->imap->imapPassword = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapPassword'];
         Yii::app()->imap->imapPort = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapPort'];
         Yii::app()->imap->imapSSL = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapSSL'];
         Yii::app()->imap->imapFolder = Yii::app()->params['emailTestAccounts']['userImapSettings']['imapFolder'];
         Yii::app()->imap->setInboundSettings();
         Yii::app()->imap->init();
         self::loadEmailHelperWithTestCredentials();
     }
     // Delete item from jobQueue, that is created when new user is created
     Yii::app()->jobQueue->deleteAll();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $contents = file_get_contents(INSTANCE_ROOT . '/protected/config/perInstanceTest.php');
     $contents = preg_replace('/\\$maintenanceMode\\s*=\\s*false;/', '$maintenanceMode = true;', $contents);
     file_put_contents(INSTANCE_ROOT . '/protected/config/perInstanceTest.php', $contents);
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $loaded = ContactsModule::loadStartingData();
 }