当前位置: 首页>>代码示例>>PHP>>正文


PHP ContactTestHelper类代码示例

本文整理汇总了PHP中ContactTestHelper的典型用法代码示例。如果您正苦于以下问题:PHP ContactTestHelper类的具体用法?PHP ContactTestHelper怎么用?PHP ContactTestHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ContactTestHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUpBeforeClass

 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();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:30,代码来源:ModelsRollUpTest.php

示例2: testSuperUserThatContactsAndLeadsShowZeroModelUserInterfaceCorrectly

 public function testSuperUserThatContactsAndLeadsShowZeroModelUserInterfaceCorrectly()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $this->assertEquals(0, Contact::getCount());
     //At this point the zero model ui should show up for contacts and leads
     $content = $this->runControllerWithNoExceptionsAndGetContent('contacts/default/list');
     $this->assertContains('Arthur Conan', $content);
     $content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/list');
     $this->assertContains('Thomas Paine', $content);
     $contact = ContactTestHelper::createContactByNameForOwner('Jimmy', $super);
     //At this point leads should still show the zero model message
     $content = $this->runControllerWithNoExceptionsAndGetContent('contacts/default/list');
     $this->assertNotContains('Arthur Conan', $content);
     $content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/list');
     $this->assertContains('Thomas Paine', $content);
     $this->assertTrue($contact->delete());
     $this->assertEquals(0, Contact::getCount());
     //Create lead.
     $lead = LeadTestHelper::createLeadByNameForOwner('Jammy', $super);
     //At this point contacts should still show the zero model message
     $content = $this->runControllerWithNoExceptionsAndGetContent('contacts/default/list');
     $this->assertContains('Arthur Conan', $content);
     $content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/list');
     $this->assertNotContains('Thomas Paine', $content);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:25,代码来源:ContactsSuperUserZeroModelsWalkthroughTest.php

示例3: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     Yii::app()->user->userModel = User::getByUsername('nobody');
     self::$account = AccountTestHelper::createAccountByNameForOwner('superAccount', Yii::app()->user->userModel);
     self::$contact = ContactTestHelper::createContactWithAccountByNameForOwner('superContact', Yii::app()->user->userModel, self::$account);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:7,代码来源:AccountContactAffiliationsRegularUserWalkthroughTest.php

示例4: testSuperUserGlobalList

 public function testSuperUserGlobalList()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     //Test if actionGlobalList return a list view for all modules
     $this->setGetArray(array('MixedModelsSearchForm' => array('anyMixedAttributesScope' => array('All'), 'term' => 't')));
     $this->resetPostArray();
     $content = $this->runControllerWithNoExceptionsAndGetContent('zurmo/default/globallist');
     $this->assertContains('<div class="cgrid-view type-accounts" id="list-view-accounts">', $content);
     $this->assertContains('<div class="cgrid-view type-contacts" id="list-view-contacts">', $content);
     $this->assertContains('<div class="cgrid-view type-leads" id="list-view-leads">', $content);
     $this->assertContains('<div class="cgrid-view type-opportunities" id="list-view-opportunities">', $content);
     //Even if there are results it should return a cgridview with no text
     $this->assertNotContains('No results found.', $content);
     //Test if actionGlobalList only show the module requested
     ContactTestHelper::createContactByNameForOwner('tim', $super);
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
     $this->setGetArray(array('MixedModelsSearchForm' => array('term' => 'd'), 'ajax' => 'list-view-accounts'));
     $this->resetPostArray();
     $content = $this->runControllerWithNoExceptionsAndGetContent('zurmo/default/globallist');
     $this->assertContains('id="AccountsForMixedModelsSearchListView"', $content);
     $this->assertNotContains('id="ContactsForMixedModelsSearchListView"', $content);
     $this->assertNotContains('id="LeadsForMixedModelsSearchListView"', $content);
     $this->assertNotContains('id="OpportunitiesForMixedModelsSearchListView">', $content);
     //TODO: Should test if the accounts created is shown
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:25,代码来源:ZurmoMixedModelsSearchSuperUserWalkthroughTest.php

示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
     ContactTestHelper::createContactWithAccountByNameForOwner('superContact', $super, $account);
     ContactTestHelper::createContactWithAccountByNameForOwner('superContact2', $super, $account);
     OpportunityTestHelper::createOpportunityStagesIfDoesNotExist();
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp2', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp3', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp4', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp5', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp6', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp7', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp8', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp9', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp10', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp11', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp12', $super, $account);
     //Setup default dashboard.
     Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, $super);
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:27,代码来源:OpportunitiesSuperUserWalkthroughTest.php

示例6: resolveEmailMessage

 protected function resolveEmailMessage($subject = 'Subject', $textContent = 'My First Message', $htmlContent = 'Some fake HTML content', $fromAddress = 'zurmo@zurmo.org', $fromName = 'Zurmo', $toAddress = 'bob.message@zurmotest.com', $toName = null, $contact = null)
 {
     if (!isset($contact)) {
         $contact = ContactTestHelper::createContactByNameForOwner('emailContact', Yii::app()->user->userModel);
     }
     $emailMessage = new EmailMessage();
     $emailMessage->owner = $contact->owner;
     $emailMessage->subject = $subject;
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = $textContent;
     $emailContent->htmlContent = $htmlContent;
     $emailMessage->content = $emailContent;
     $sender = new EmailMessageSender();
     $sender->fromAddress = $fromAddress;
     $sender->fromName = $fromName;
     $sender->personsOrAccounts->add(Yii::app()->user->userModel);
     $emailMessage->sender = $sender;
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = $toAddress;
     if (!isset($toName)) {
         $toName = strval($contact);
     }
     $recipient->toName = $toName;
     $recipient->personsOrAccounts->add($contact);
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $emailMessage->recipients->add($recipient);
     $emailBox = EmailBoxUtil::getDefaultEmailBoxByUser(Yii::app()->user->userModel);
     $emailMessage->folder = EmailFolder::getByBoxAndType($emailBox, EmailFolder::TYPE_OUTBOX);
     $saved = $emailMessage->save();
     if (!$saved) {
         var_dump($emailMessage->getErrors());
         throw new FailedToSaveModelException();
     }
     return $emailMessage;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:35,代码来源:AutoresponderOrCampaignBaseTest.php

示例7: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $nobody = UserTestHelper::createBasicUser('nobody');
     $nobody->setRight('MarketingListsModule', MarketingListsModule::getAccessRight());
     $saved = $nobody->save();
     static::assertTrue($saved);
     Yii::app()->user->userModel = $nobody;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('nobodyAccount', $nobody);
     $marketingList1 = MarketingListTestHelper::createMarketingListByName('MarketingList1', 'MarketingList Description1');
     $marketingList2 = MarketingListTestHelper::createMarketingListByName('MarketingList2', 'MarketingList Description2');
     for ($i = 0; $i < 17; $i++) {
         if ($i % 2) {
             $unsubscribed = 0;
         } else {
             $unsubscribed = 1;
         }
         $contact1 = ContactTestHelper::createContactWithAccountByNameForOwner('nobodyContact1' . $i, $nobody, $account);
         $contact2 = ContactTestHelper::createContactWithAccountByNameForOwner('nobodyContact2' . $i, $nobody, $account);
         MarketingListMemberTestHelper::createMarketingListMember($unsubscribed, $marketingList1, $contact1);
         MarketingListMemberTestHelper::createMarketingListMember($unsubscribed, $marketingList2, $contact2);
     }
     AllPermissionsOptimizationUtil::rebuild();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:26,代码来源:MarketingListMemberControllerRegularUserWalkthroughTest.php

示例8: testCreateAddAndSaveAndRemoveByIndexRelatedModels

 public function testCreateAddAndSaveAndRemoveByIndexRelatedModels()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $user = UserTestHelper::createBasicUser('Billy');
     $account = new Account();
     $account->owner = $user;
     $account->name = 'Wibble Corp';
     $this->assertTrue($account->save());
     for ($i = 0; $i < self::CONTACTS; $i++) {
         $contact = ContactTestHelper::createContactByNameForOwner('sampleContact' . $i, Yii::app()->user->userModel);
         $account->contacts->add($contact);
     }
     $this->assertTrue($account->save());
     $contact = $account->contacts[0];
     $this->assertFalse($account->isModified());
     $this->assertFalse($contact->isModified());
     $this->assertTrue($account->save());
     $this->assertFalse($account->isModified());
     $this->assertFalse($contact->isModified());
     $accountId = $account->id;
     unset($account);
     $account = Account::getById($accountId);
     $this->assertEquals('Wibble Corp', $account->name);
     $this->assertEquals(self::CONTACTS, $account->contacts->count());
     $this->assertEquals("{$account->contacts->count()} records.", strval($account->contacts));
     $contact = $account->contacts[0];
     $description = $contact->description;
     $contact->description = "this is a contact";
     $this->assertTrue($account->isModified());
     $this->assertTrue($contact->isModified());
     $this->assertTrue($account->save());
     $this->assertFalse($account->isModified());
     $this->assertFalse($contact->isModified());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:34,代码来源:RedBeanRelatedModelsTest.php

示例9: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     $super = User::getByUsername('super');
     $super->primaryEmail->emailAddress = 'super@zurmo.org';
     $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();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:26,代码来源:CampaignItemSummaryListViewColumnAdapterTest.php

示例10: testCreateAndGetMeetingById

 public function testCreateAndGetMeetingById()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $accounts = Account::getByName('anAccount');
     $contact1 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact', $super, $accounts[0]);
     $contact2 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact2', $super, $accounts[0]);
     $contact3 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact3', $super, $accounts[0]);
     $user = UserTestHelper::createBasicUser('Billy');
     $startStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
     $endStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 11000);
     $meeting = new Meeting();
     $meeting->name = 'MyMeeting';
     $meeting->owner = $user;
     $meeting->location = 'my location';
     $meeting->category->value = 'Call';
     $meeting->startDateTime = $startStamp;
     $meeting->endDateTime = $endStamp;
     $meeting->description = 'my test description';
     $meeting->activityItems->add($accounts[0]);
     $meeting->activityItems->add($contact1);
     $meeting->activityItems->add($contact2);
     $meeting->activityItems->add($contact3);
     $this->assertTrue($meeting->save());
     $id = $meeting->id;
     unset($meeting);
     $meeting = Meeting::getById($id);
     $this->assertEquals('MyMeeting', $meeting->name);
     $this->assertEquals($startStamp, $meeting->startDateTime);
     $this->assertEquals($endStamp, $meeting->endDateTime);
     $this->assertEquals('my test description', $meeting->description);
     $this->assertEquals($user, $meeting->owner);
     $this->assertEquals(4, $meeting->activityItems->count());
     $this->assertEquals($accounts[0], $meeting->activityItems->offsetGet(0));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:35,代码来源:MeetingTest.php

示例11: testUnlinkContactForAccount

 public function testUnlinkContactForAccount()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $simpleUser = User::getByUsername('simpleUser');
     Yii::app()->user->userModel = $simpleUser;
     $simpleUser->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
     $simpleUser->setRight('AccountsModule', AccountsModule::RIGHT_CREATE_ACCOUNTS);
     $simpleUser->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
     $simpleUser->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
     $this->assertTrue($simpleUser->save());
     $account = AccountTestHelper::createAccountByNameForOwner('simpleUserAccount', $simpleUser);
     $contact = ContactTestHelper::createContactWithAccountByNameForOwner('simpleUserContact', $simpleUser, $account);
     $accounts = Account::getAll();
     $this->assertEquals(1, count($accounts));
     $contacts = Contact::getAll();
     $this->assertEquals(1, count($contacts));
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'simpleUserAccount');
     $this->setGetArray(array('id' => $superAccountId));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
     $contactId = self::getModelIdByModelNameAndName('Contact', 'simpleUserContact simpleUserContactson');
     //unlinking the contact
     $this->setGetArray(array('id' => $contactId, 'relationModelClassName' => 'Account', 'relationModelId' => $superAccountId, 'relationModelRelationName' => 'contacts'));
     $content = $this->runControllerWithNoExceptionsAndGetContent('contacts/default/unlink', true);
     $accounts = Account::getAll();
     $this->assertEquals(1, count($accounts));
     $contacts = Contact::getAll();
     $contactId = $contacts[0]->id;
     $contacts[0]->forget();
     $contact = Contact::getById($contactId);
     $this->assertTrue($contact->account->id < 0);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:32,代码来源:AccountsRegularUserUnlinkWalkthroughTest.php

示例12: setUpBeforeClass

 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 = 'sally@zurmoland.com';
     $contact->secondaryEmail->emailAddress = 'toMakeSureNoFreeze@works.com';
     $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@zurmoland.com';
     $molly->secondaryEmail->emailAddress = 'toMakeSureNoFreeze@works.zur';
     $contact->save();
     ReadPermissionsOptimizationUtil::securableItemGivenPermissionsForUser($contact, $billy);
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:28,代码来源:EmailMessageUtilTest.php

示例13: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $user = UserTestHelper::createBasicUser('steve');
     $user->primaryEmail->emailAddress = 'steve@example.com';
     $user->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
     assert($user->save());
     // Not Coding Standard
     $contact1 = ContactTestHelper::createContactByNameForOwner('peter', $user);
     $contact1->primaryEmail->emailAddress = 'peter@example.com';
     $contact1->secondaryEmail->emailAddress = 'peter2@example.com';
     assert($contact1->save());
     // Not Coding Standard
     $contactsOrLeads = ContactSearch::getContactsByAnyEmailAddress('peter@example.com', null, null);
     $contact2 = ContactTestHelper::createContactByNameForOwner('jim', $user);
     $contact2->primaryEmail->emailAddress = 'jim@example.com';
     assert($contact2->save());
     // Not Coding Standard
     $nonExistingUserEmail = 'jill@example.com';
     self::$user = $user;
     self::$contact1 = $contact1;
     self::$contact2 = $contact2;
     self::$nonExistingUserEmail = $nonExistingUserEmail;
     Yii::app()->imap->imapUsername = 'dropbox@example.com';
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:26,代码来源:EmailArchivingJobDocumentationTest.php

示例14: testRenderCorrectStateTranslationAfterCallingContactStateLabel

 public function testRenderCorrectStateTranslationAfterCallingContactStateLabel()
 {
     $super = User::getByUsername('super');
     $contact = ContactTestHelper::createContactByNameForOwner('test', $super);
     ZurmoHtml::activeLabel($contact, 'state');
     $element = new AddressElement($contact, 'primaryAddress', new ZurmoActiveForm());
     $this->assertContains('<label for="Contact_primaryAddress_state">State</label>', $element->render());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:8,代码来源:AddressElementTest.php

示例15: testResolveModelUrl

 /**
  * @depends testIsSpecialMergeTag
  */
 public function testResolveModelUrl()
 {
     $contact = ContactTestHelper::createContactByNameForOwner('contact 01', Yii::app()->user->userModel);
     $resolvedModelUrl = SpecialMergeTagsAdapter::resolve('modelUrl', $contact);
     $this->assertNotNull($resolvedModelUrl);
     $expectedSuffix = '/contacts/default/details?id=' . $contact->id;
     $this->assertContains($expectedSuffix, $resolvedModelUrl);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:11,代码来源:SpecialMergeTagsAdapterTest.php


注:本文中的ContactTestHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。