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


PHP EmailMessage::getCount方法代码示例

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


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

示例1: testRun

 public function testRun()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $outboxFolder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX);
     $sentFolder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_SENT);
     $emailMessage = EmailMessageTestHelper::createDraftSystemEmail('My Email Message', $super);
     $emailMessage->folder = $outboxFolder;
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $emailMessageId = $emailMessage->id;
     $emailMessage->forget();
     unset($emailMessage);
     $emailMessage2 = EmailMessageTestHelper::createDraftSystemEmail('My Email Message', $super);
     $emailMessage2->folder = $outboxFolder;
     $saved = $emailMessage2->save();
     $this->assertTrue($saved);
     $emailMessage2Id = $emailMessage2->id;
     $emailMessage2->forget();
     unset($emailMessage2);
     $this->assertEquals(2, EmailMessage::getCount());
     $job = new ProcessOutboundEmailJob();
     $this->assertTrue($job->run());
     $emailMessages = EmailMessage::getAll();
     $this->assertEquals(2, count($emailMessages));
     $emailMessage = EmailMessage::getById($emailMessageId);
     $this->assertEquals($sentFolder, $emailMessage->folder);
     $emailMessage2 = EmailMessage::getById($emailMessage2Id);
     $this->assertEquals($sentFolder, $emailMessage2->folder);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:31,代码来源:ProcessOutboundEmailJobTest.php

示例2: testRun

 public function testRun()
 {
     $quote = DatabaseCompatibilityUtil::getQuote();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_SENT);
     //Create 2 sent notifications, and set one with a date over a week ago (8 days ago) for the modifiedDateTime
     $emailMessage = EmailMessageTestHelper::createDraftSystemEmail('My Email Message', $super);
     $emailMessage->folder = $folder;
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $modifiedDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 8);
     $sql = "Update item set modifieddatetime = '" . $modifiedDateTime . "' where id = " . $emailMessage->getClassId('Item');
     ZurmoRedBean::exec($sql);
     $emailMessage2 = EmailMessageTestHelper::createDraftSystemEmail('My Email Message 2', $super);
     $emailMessage2->folder = $folder;
     $saved = $emailMessage2->save();
     $this->assertTrue($saved);
     $this->assertEquals(2, EmailMessage::getCount());
     $job = new ClearSentNotificationsEmailJob();
     $this->assertTrue($job->run());
     $emailMessages = EmailMessage::getAll();
     $this->assertEquals(1, count($emailMessages));
     $this->assertEquals($emailMessage2->id, $emailMessages[0]->id);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:26,代码来源:ClearSentNotificationsEmailJobTest.php

示例3: testRun

 public function testRun()
 {
     //Create workflow
     $workflow = new Workflow();
     $workflow->setDescription('aDescription');
     $workflow->setIsActive(true);
     $workflow->setOrder(5);
     $workflow->setModuleClassName('WorkflowsTest2Module');
     $workflow->setName('myFirstWorkflow');
     $workflow->setTriggerOn(Workflow::TRIGGER_ON_NEW_AND_EXISTING);
     $workflow->setType(Workflow::TYPE_ON_SAVE);
     $workflow->setTriggersStructure('1');
     //Add action that is missing required owner
     $action = new ActionForWorkflowForm('WorkflowModelTestItem2', Workflow::TYPE_ON_SAVE);
     $action->type = ActionForWorkflowForm::TYPE_CREATE;
     $action->relation = 'hasMany2';
     $attributes = array('string' => array('shouldSetValue' => '1', 'type' => WorkflowActionAttributeForm::TYPE_STATIC, 'value' => 'jason'), 'lastName' => array('shouldSetValue' => '1', 'type' => WorkflowActionAttributeForm::TYPE_STATIC, 'value' => 'jason'));
     $action->setAttributes(array(ActionForWorkflowForm::ACTION_ATTRIBUTES => $attributes));
     $workflow->addAction($action);
     //Create the saved Workflow
     $savedWorkflow = new SavedWorkflow();
     SavedWorkflowToWorkflowAdapter::resolveWorkflowToSavedWorkflow($workflow, $savedWorkflow);
     $saved = $savedWorkflow->save();
     $this->assertTrue($saved);
     $this->assertEquals(0, Notification::getCount());
     $this->assertEquals(0, EmailMessage::getCount());
     $job = new WorkflowValidityCheckJob();
     $this->assertTrue($job->run());
     $this->assertEquals(1, Notification::getCount());
     $this->assertEquals(1, EmailMessage::getCount());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:31,代码来源:WorkflowValidityCheckJobTest.php

示例4: testRenderSummaryContentWithEmailMessage

 /**
  * Testing that each model type can render properly and does not throw an exception
  */
 public function testRenderSummaryContentWithEmailMessage()
 {
     $super = User::getByUsername('super');
     $billy = User::getByUsername('billy');
     $this->assertEquals(0, EmailMessage::getCount());
     $emailMessage = new EmailMessage();
     $emailMessage->owner = BaseControlUserConfigUtil::getUserToRunAs();
     $emailMessage->subject = 'My First Email';
     //Set sender, and recipient, and content
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = 'My First Message';
     $emailContent->htmlContent = 'Some fake HTML content';
     $emailMessage->content = $emailContent;
     //Sending from the system, does not have a 'person'.
     $sender = new EmailMessageSender();
     $sender->fromAddress = 'system@somewhere.com';
     $sender->fromName = 'Zurmo System';
     $sender->personsOrAccounts->add($super);
     $emailMessage->sender = $sender;
     //Recipient is billy.
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'billy@fakeemail.com';
     $recipient->toName = 'Billy James';
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $recipient->personsOrAccounts->add($billy);
     $emailMessage->recipients->add($recipient);
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $content = ActivitiesUtil::renderSummaryContent($emailMessage, 'someUrl', LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL, 'HomeModule');
     $content = ActivitiesUtil::renderSummaryContent($emailMessage, 'someUrl', LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER, 'HomeModule');
     $content = ActivitiesUtil::renderSummaryContent($emailMessage, 'someUrl', LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL, 'UserModule');
     $content = ActivitiesUtil::renderSummaryContent($emailMessage, 'someUrl', LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER, 'UserModule');
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:38,代码来源:ActivitiesUtilTest.php

示例5: testCreateEmailMessageThatIsANotification

 /**
  * A notification email is different than a regular outbound email because it is owned by a super user
  * that is different than the user logged in.  So the sender does not have a 'person'
  */
 public function testCreateEmailMessageThatIsANotification()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $billy = User::getByUsername('billy');
     $this->assertEquals(0, EmailMessage::getCount());
     $emailMessage = new EmailMessage();
     $emailMessage->owner = BaseControlUserConfigUtil::getUserToRunAs();
     $emailMessage->subject = 'My First Email';
     //Set sender, and recipient, and content
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = 'My First Message';
     $emailContent->htmlContent = 'Some fake HTML content';
     $emailMessage->content = $emailContent;
     //Sending from the system, does not have a 'person'.
     $sender = new EmailMessageSender();
     $sender->fromAddress = 'system@somewhere.com';
     $sender->fromName = 'Zurmo System';
     $emailMessage->sender = $sender;
     //Recipient is billy.
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'billy@fakeemail.com';
     $recipient->toName = 'Billy James';
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $recipient->personsOrAccounts->add($billy);
     $emailMessage->recipients->add($recipient);
     //At this point the message is in no folder
     $this->assertTrue($emailMessage->folder->id < 0);
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     //Save, at this point the email should be in the draft folder
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $this->assertTrue($emailMessage->folder->id > 0);
     $this->assertEquals(0, EmailMessageSendError::getCount());
     $emailMessageSendError = new EmailMessageSendError();
     $data = array();
     $data['message'] = 'error message';
     $emailMessageSendError->serializedData = serialize($data);
     $emailMessage->folder = EmailFolder::getByBoxAndType($emailMessage->folder->emailBox, EmailFolder::TYPE_OUTBOX_ERROR);
     $emailMessage->error = $emailMessageSendError;
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $this->assertEquals(1, EmailMessageSendError::getCount());
     //Now swap the error with a new one
     $emailMessageId = $emailMessage->id;
     $emailMessage->forget();
     $emailMessage = EmailMessage::getById($emailMessageId);
     $emailMessageSendError = new EmailMessageSendError();
     $data = array();
     $data['message'] = 'error message 2';
     $emailMessageSendError->serializedData = serialize($data);
     $emailMessage->error = $emailMessageSendError;
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $this->assertEquals(1, EmailMessageSendError::getCount());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:61,代码来源:EmailMessageSendErrorTest.php

示例6: testRun

 public function testRun()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $this->assertEquals(0, EmailMessage::getCount());
     $job = new TestOutboundEmailJob();
     $this->assertTrue($job->run());
     $emailMessages = EmailMessage::getAll();
     $this->assertEquals(1, count($emailMessages));
     $this->assertEquals(EmailFolder::TYPE_SENT, $emailMessages[0]->folder->type);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:11,代码来源:TestOutboundEmailJobTest.php

示例7: testProcessWorkflowAfterSave

 public function testProcessWorkflowAfterSave()
 {
     $model = new WorkflowModelTestItem();
     $event = new CEvent($model);
     $observer = new WorkflowsObserver();
     $observer->setDepth(25);
     $this->assertEquals(0, Notification::getCount());
     $this->assertEquals(0, EmailMessage::getCount());
     $observer->processWorkflowAfterSave($event);
     $this->assertEquals(1, Notification::getCount());
     $this->assertEquals(1, EmailMessage::getCount());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:12,代码来源:WorkflowsObserverTest.php

示例8: testRunWithCampaignPausedAfterAllItemsGeneratedAndThenUnpaused

 public function testRunWithCampaignPausedAfterAllItemsGeneratedAndThenUnpaused()
 {
     // Cleanup
     Campaign::deleteAll();
     $this->assertEquals(0, Campaign::getCount());
     $this->assertEquals(0, CampaignItem::getCount());
     $this->assertEquals(0, CampaignItemActivity::getCount());
     MarketingList::deleteAll();
     $this->assertEquals(0, MarketingList::getCount());
     $this->assertEquals(0, MarketingListMember::getCount());
     EmailMessage::deleteAll();
     $this->assertEquals(0, EmailMessage::getCount());
     $this->assertEquals(0, EmailMessageContent::getCount());
     $this->assertEquals(0, EmailMessageSender::getCount());
     $this->assertEquals(0, EmailMessageRecipient::getCount());
     Contact::deleteAll();
     $this->assertEquals(0, Contact::getCount());
     // setup an email address for contacts
     $email = new Email();
     $email->emailAddress = 'demo@zurmo.com';
     // create a marketing list with 5 members
     $marketingList = MarketingListTestHelper::createMarketingListByName('marketingList 05');
     $marketingListId = $marketingList->id;
     for ($i = 1; $i <= 5; $i++) {
         $contact = ContactTestHelper::createContactByNameForOwner('campaignContact 0' . $i, $this->user);
         $contact->primaryEmail = $email;
         $this->assertTrue($contact->save());
         MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList, $contact);
     }
     $marketingList->forgetAll();
     // create a due campaign with that marketing list
     $campaign = CampaignTestHelper::createCampaign('campaign 04', 'subject', 'text Content', 'Html Content', null, null, null, null, null, null, MarketingList::getById($marketingListId));
     $campaignId = $campaign->id;
     /*
      * Run 1:
      * CampaignGenerateDueCampaignItemsJob
      * status == processing
      * items generated but unprocessed
      *
      * CampaignQueueMessagesInOutboxJob
      * status == processing
      * items processed with email messages generated and queued
      *
      * ProcessOutboundEmailJob
      * status == processing
      * email items attempted to be sent
      *
      * Run 2:
      * Pause the campaign
      * items are processed and still present
      *
      * Unpause the campaign
      * status == active
      * items are processed and still present
      *
      * CampaignGenerateDueCampaignItemsJob
      * status == processing
      * ensure all items are present and processed
      *
      * CampaignQueueMessagesInOutboxJob
      * status == processing
      * ensure all items are present and processed
      * ensure all email messages are present with correct folder type
      *
      * ProcessOutboundEmailJob
      * ensure all email messages are present with correct folder type
      * status == processing
      *
      *
      * Run 3:
      * Mark Campaign as Completed
      * status == completed
      */
     // we have to do this to ensure when we retrieve the data status is updated from db.
     $campaign->forgetAll();
     $this->assertEmpty(CampaignItem::getAll());
     // Run 1 starts here
     // Run CampaignGenerateDueCampaignItemsJob
     $job = new CampaignGenerateDueCampaignItemsJob();
     $this->assertTrue($job->run());
     $campaign = Campaign::getById($campaignId);
     // ensure status is processing
     $this->assertEquals(Campaign::STATUS_PROCESSING, $campaign->status);
     // ensure 5 campaign items have been generated
     $this->assertEquals(5, CampaignItem::getCount());
     // ensure all 5 campaign items are unprocessed
     $campaignItems = CampaignItem::getByProcessedAndCampaignId(0, $campaignId);
     $this->assertNotEmpty($campaignItems);
     $this->assertCount(5, $campaignItems);
     // Run CampaignQueueMessagesInOutboxJob
     $job = new CampaignQueueMessagesInOutboxJob();
     $this->assertTrue($job->run());
     // Ensure campaign status
     $campaign = Campaign::getById($campaignId);
     $this->assertEquals(Campaign::STATUS_PROCESSING, $campaign->status);
     // ensure all 5 campaign items are processed
     $campaignItems = CampaignItem::getByProcessedAndCampaignId(1, $campaignId);
     $this->assertNotEmpty($campaignItems);
     $this->assertCount(5, $campaignItems);
     // Ensure 5 new email messages
//.........这里部分代码省略.........
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:101,代码来源:CampaignMarkCompletedJobTest.php

示例9: testSubmitWithInboxNotificationSettingDisabledAndEmailNotificationSettingDisabled

 public function testSubmitWithInboxNotificationSettingDisabledAndEmailNotificationSettingDisabled()
 {
     $initialNotificationCount = Notification::getCount();
     $initialEmailMessageCount = EmailMessage::getCount();
     $rules = new SimpleNotificationRules();
     $rules->setAllowDuplicates(true);
     $rules->addUser($this->user);
     $inboxAndEmailNotificationSettings = UserTestHelper::getDefaultNotificationSettingsValuesForTestUser();
     $inboxAndEmailNotificationSettings['enableSimpleNotification']['email'] = false;
     $inboxAndEmailNotificationSettings['enableSimpleNotification']['inbox'] = false;
     UserNotificationUtil::setValue($this->user, $inboxAndEmailNotificationSettings, 'inboxAndEmailNotificationSettings', false);
     $this->assertFalse(UserNotificationUtil::isEnabledByUserAndNotificationNameAndType($this->user, 'enableSimpleNotification', 'email'));
     $this->assertFalse(UserNotificationUtil::isEnabledByUserAndNotificationNameAndType($this->user, 'enableSimpleNotification', 'inbox'));
     $message = new NotificationMessage();
     $message->textContent = 'text content for' . __FUNCTION__;
     $message->htmlContent = 'html content for' . __FUNCTION__;
     NotificationsUtil::submit($message, $rules);
     $this->assertEquals($initialNotificationCount, Notification::getCount());
     $this->assertEquals($initialEmailMessageCount, EmailMessage::getCount());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:20,代码来源:NotificationsUtilTest.php

示例10: testRunWithMissingTriggerMultiselectPicklistValue

 public function testRunWithMissingTriggerMultiselectPicklistValue()
 {
     $this->clearNotificationsWorkflowsAndEmailMessages();
     $this->createStageValues();
     //Create workflow
     $workflow = new Workflow();
     $workflow->setDescription('bDescription');
     $workflow->setIsActive(true);
     $workflow->setOrder(5);
     $workflow->setModuleClassName('OpportunitiesModule');
     $workflow->setName('mySecondWorkflow');
     $workflow->setTriggerOn(Workflow::TRIGGER_ON_NEW_AND_EXISTING);
     $workflow->setType(Workflow::TYPE_ON_SAVE);
     $workflow->setTriggersStructure('1');
     $trigger = new TriggerForWorkflowForm('OpportunitiesModule', 'Opportunity', Workflow::TYPE_ON_SAVE);
     $trigger->attributeIndexOrDerivedType = 'stage';
     $trigger->value = 'Closed Won,Negotiating';
     $trigger->operator = OperatorRules::TYPE_ONE_OF;
     $trigger->relationFilter = TriggerForWorkflowForm::RELATION_FILTER_ANY;
     $workflow->addTrigger($trigger);
     //Create the saved Workflow
     $savedWorkflow = new SavedWorkflow();
     SavedWorkflowToWorkflowAdapter::resolveWorkflowToSavedWorkflow($workflow, $savedWorkflow);
     $saved = $savedWorkflow->save();
     $this->assertTrue($saved);
     $this->assertEquals(0, Notification::getCount());
     $this->assertEquals(0, EmailMessage::getCount());
     $job = new WorkflowValidityCheckJob();
     $this->assertTrue($job->run());
     $this->assertEquals(0, Notification::getCount());
     $this->assertEquals(0, EmailMessage::getCount());
     $this->clearNotificationsWorkflowsAndEmailMessages();
     $workflow = new Workflow();
     $workflow->setDescription('cDescription');
     $workflow->setIsActive(true);
     $workflow->setOrder(5);
     $workflow->setModuleClassName('OpportunitiesModule');
     $workflow->setName('mySecondWorkflow');
     $workflow->setTriggerOn(Workflow::TRIGGER_ON_NEW_AND_EXISTING);
     $workflow->setType(Workflow::TYPE_ON_SAVE);
     $workflow->setTriggersStructure('1');
     $trigger = new TriggerForWorkflowForm('OpportunitiesModule', 'Opportunity', Workflow::TYPE_ON_SAVE);
     $trigger->attributeIndexOrDerivedType = 'stage';
     $trigger->value = 'Closed Won,Unexisting state';
     $trigger->operator = OperatorRules::TYPE_BECOMES;
     $trigger->relationFilter = TriggerForWorkflowForm::RELATION_FILTER_ANY;
     $workflow->addTrigger($trigger);
     //Create the saved Workflow
     $savedWorkflow = new SavedWorkflow();
     SavedWorkflowToWorkflowAdapter::resolveWorkflowToSavedWorkflow($workflow, $savedWorkflow);
     $saved = $savedWorkflow->save();
     $this->assertTrue($saved);
     $this->assertEquals(0, Notification::getCount());
     $this->assertEquals(0, EmailMessage::getCount());
     $job = new WorkflowValidityCheckJob();
     $this->assertTrue($job->run());
     $this->assertEquals(1, Notification::getCount());
     $this->assertEquals(1, EmailMessage::getCount());
 }
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info,代码行数:59,代码来源:WorkflowValidityCheckJobTest.php

示例11: testResolveEmailInvitesByPeople

 /**
  * @depends testResolveConversationParticipants
  */
 public function testResolveEmailInvitesByPeople()
 {
     $this->assertEquals(0, Notification::getCount());
     $this->assertEquals(0, EmailMessage::getCount());
     $super = Yii::app()->user->userModel;
     $super->primaryEmail->emailAddress = 'super@zurmo.com';
     NotificationTestHelper::setNotificationSettingsForUser($super, 'ConversationInvites');
     $jack = User::getByUsername('jack');
     $jack->primaryEmail->emailAddress = 'jack@zurmo.com';
     NotificationTestHelper::setNotificationSettingsForUser($jack, 'ConversationInvites', true, false);
     $steven = User::getByUsername('steven');
     $steven->primaryEmail->emailAddress = 'steven@zurmo.com';
     NotificationTestHelper::setNotificationSettingsForUser($steven, 'ConversationInvites', false, true);
     $mary = User::getByUsername('mary');
     $mary->primaryEmail->emailAddress = 'mary@zurmo.com';
     NotificationTestHelper::setNotificationSettingsForUser($mary, 'ConversationInvites', false, false);
     $conversation = new Conversation();
     $conversation->owner = $super;
     $conversation->subject = 'Test Resolve Conversation Participants';
     $conversation->description = 'This is for testing conversation participants.';
     $this->assertTrue($conversation->save());
     ConversationParticipantsUtil::resolveEmailInvitesByPeople($conversation, array($super, $jack, $steven, $mary));
     $this->assertEquals(2, Notification::getCount());
     $notifications = Notification::getAll();
     $this->assertContains('<h2 class="h2">Join the Conversation</h2>Clark Kent would like you to join a conversation <strong>"Test Resolve Conversation Participants"</strong><br/>', $notifications[0]->notificationMessage->htmlContent);
     $this->assertContains('Clark Kent would like you to join a conversation "Test Resolve Conversation Participants"', $notifications[0]->notificationMessage->textContent);
     $this->assertEquals(2, EmailMessage::getCount());
     $emailMessages = EmailMessage::getAll();
     $this->assertContains('<h2 class="h2">Join the Conversation</h2>Clark Kent would like you to join a conversation <strong>"Test Resolve Conversation Participants"</strong><br/>', $emailMessages[0]->content->htmlContent);
     $this->assertContains('Powered By <a href="http://www.zurmo.com">Zurmo</a>', $emailMessages[0]->content->htmlContent);
     $this->assertContains('Clark Kent would like you to join a conversation "Test Resolve Conversation Participants"', $emailMessages[0]->content->textContent);
     $this->assertContains('Manage your email preferences', $emailMessages[0]->content->textContent);
     $this->assertEquals('You have been invited to participate in a conversation', $emailMessages[0]->subject);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:37,代码来源:ConversationParticipantsUtilTest.php

示例12: testExportRedBeanDataProviderWithMultiplePagesOfData

 /**
  * @depends testExportByModelIds
  */
 public function testExportRedBeanDataProviderWithMultiplePagesOfData()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Disabling email notification
     NotificationTestHelper::setNotificationSettingsForUser($super, 'ExportProcessCompleted', true, false);
     $numberOfUserNotifications = Notification::getCountByTypeAndUser('ExportProcessCompleted', Yii::app()->user->userModel);
     $numberOfEmailMessages = EmailMessage::getCount();
     $account = new Account(false);
     $searchForm = new AccountsSearchForm($account);
     $dataProvider = ExportTestHelper::makeRedBeanDataProvider($searchForm, 'Account', 0, Yii::app()->user->userModel->id);
     $totalItems = $dataProvider->getTotalItemCount();
     $this->assertEquals(4, $totalItems);
     $exportItem = new ExportItem();
     $exportItem->isCompleted = 0;
     $exportItem->exportFileType = 'csv';
     $exportItem->exportFileName = 'test3';
     $exportItem->modelClassName = 'Account';
     $exportItem->serializedData = serialize($dataProvider);
     $this->assertTrue($exportItem->save());
     $id = $exportItem->id;
     $exportItem->forget();
     unset($exportItem);
     ExportModule::$asynchronousPageSize = 2;
     //Delete queued jobs from test exportItems created above
     Yii::app()->jobQueue->deleteAll();
     $job = new ExportJob();
     $this->assertEquals(0, count(Yii::app()->jobQueue->getAll()));
     $this->assertTrue($job->run());
     $this->assertEquals(0, count(Yii::app()->jobQueue->getAll()));
     $exportItem = ExportItem::getById($id);
     $fileModel = $exportItem->exportFileModel;
     $this->assertEquals(1, $exportItem->isCompleted);
     $this->assertEquals('csv', $exportItem->exportFileType);
     $this->assertEquals('test3', $exportItem->exportFileName);
     $this->assertTrue($fileModel instanceof ExportFileModel);
     // Get csv string via regular csv export process(directly, not in background)
     // We suppose that csv generated thisway is corrected, this function itself
     // is tested in another test.
     $data = array();
     $rows = $dataProvider->getData();
     $modelToExportAdapter = new ModelToExportAdapter($rows[0]);
     $headerData = $modelToExportAdapter->getHeaderData();
     foreach ($rows as $model) {
         $modelToExportAdapter = new ModelToExportAdapter($model);
         $data[] = $modelToExportAdapter->getData();
     }
     $output = ExportItemToCsvFileUtil::export($data, $headerData, 'test3.csv', false);
     $this->assertEquals($output, $fileModel->fileContent->content);
     // Check if user got notification message, and if its type is ExportProcessCompleted
     $this->assertEquals($numberOfUserNotifications + 1, Notification::getCountByTypeAndUser('ExportProcessCompleted', Yii::app()->user->userModel));
     //Check no email notification was sent to super because he has disabled it
     $this->assertEquals($numberOfEmailMessages, EmailMessage::getCount());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:57,代码来源:ExportJobTest.php

示例13: testGetByFolderTypeAndCampaignId

 public function testGetByFolderTypeAndCampaignId()
 {
     $countBefore = EmailMessage::getCount();
     $job = new CampaignQueueMessagesInOutboxJob();
     $email = new Email();
     $email->emailAddress = 'demo@zurmo.com';
     $contact = ContactTestHelper::createContactByNameForOwner('contact 02', $this->user);
     $contact->primaryEmail = $email;
     $this->assertTrue($contact->save());
     $marketingList = MarketingListTestHelper::createMarketingListByName('marketingList 02');
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList, $contact);
     $campaign = CampaignTestHelper::createCampaign('campaign 02', 'subject', 'text Content', 'Html Content', null, null, null, Campaign::STATUS_PROCESSING, null, 0, $marketingList);
     $processed = 0;
     CampaignItemTestHelper::createCampaignItem($processed, $campaign, $contact);
     $this->assertTrue($job->run());
     $campaignItemsProcessed = CampaignItem::getByProcessedAndCampaignId(1, $campaign->id);
     $this->assertCount(1, $campaignItemsProcessed);
     $countAfter = EmailMessage::getCount();
     $this->assertEquals($countAfter, $countBefore + 1);
     $outboxCount = count(EmailMessage::getByFolderTypeAndCampaignId(EmailFolder::TYPE_OUTBOX, $campaign->id));
     $this->assertEquals(1, $outboxCount);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:22,代码来源:EmailMessageTest.php

示例14: testMultipleRecipientsAndTypes

 /**
  * @depends testCreateAndSendEmailMessageWithAttachment
  */
 public function testMultipleRecipientsAndTypes()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $billy = User::getByUsername('billy');
     $jane = User::getByUsername('jane');
     $sally = User::getByUsername('sally');
     $jason = User::getByUsername('jason');
     $this->assertEquals(3, EmailMessage::getCount());
     $emailMessage = new EmailMessage();
     $emailMessage->owner = $jane;
     $emailMessage->subject = 'My Third Email';
     //Attempt to save without setting required information
     $saved = $emailMessage->save();
     $this->assertFalse($saved);
     $compareData = array('folder' => array('name' => array('Name cannot be blank.'), 'emailBox' => array('name' => array('Name cannot be blank.'))), 'sender' => array('fromAddress' => array('From Address cannot be blank.')));
     $this->assertEquals($compareData, $emailMessage->getErrors());
     //Set sender, and recipient, and content
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = 'My Third Message';
     $emailMessage->content = $emailContent;
     //Sending from jane
     $sender = new EmailMessageSender();
     $sender->fromAddress = 'jane@fakeemail.com';
     $sender->fromName = 'Jane Smith';
     $sender->personsOrAccounts->add($jane);
     $emailMessage->sender = $sender;
     //Recipient is billy.
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'billy@fakeemail.com';
     $recipient->toName = 'Billy James';
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $recipient->personsOrAccounts->add($billy);
     $emailMessage->recipients->add($recipient);
     //CC recipient is Sally
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'sally@fakeemail.com';
     $recipient->toName = 'Sally Pail';
     $recipient->type = EmailMessageRecipient::TYPE_CC;
     $recipient->personsOrAccounts->add($sally);
     $emailMessage->recipients->add($recipient);
     //BCC recipient is Jason
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'jason@fakeemail.com';
     $recipient->toName = 'Jason Blue';
     $recipient->type = EmailMessageRecipient::TYPE_BCC;
     $recipient->personsOrAccounts->add($jason);
     $emailMessage->recipients->add($recipient);
     //At this point the message is not in a folder.
     $this->assertTrue($emailMessage->folder->id < 0);
     $box = EmailBox::resolveAndGetByName('JaneBox');
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     //Save, at this point the email should be in the draft folder
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $this->assertTrue($emailMessage->folder->id > 0);
     //Now send the message.
     Yii::app()->emailHelper->send($emailMessage);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:62,代码来源:EmailMessageTest.php

示例15: testRunCaseFive

 /**
  * Check if only new messages are pulled from dropdown
  * Also check case if message will be matched with user/contact/account primary email
  *
  * @depends testRunCaseFour
  */
 public function testRunCaseFive()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $user = User::getByUsername('steve');
     Yii::app()->imap->connect();
     ContactTestHelper::createContactByNameForOwner('contact', $user);
     $contacts = Contact::getByName('contact contactson');
     $contacts[0]->primaryEmail->emailAddress = Yii::app()->params['emailTestAccounts']['testEmailAddress'];
     $this->assertTrue($contacts[0]->save());
     AccountTestHelper::createAccountByNameForOwner('account', $user);
     $accounts = Account::getByName('account');
     $accounts[0]->primaryEmail->emailAddress = Yii::app()->params['emailTestAccounts']['testEmailAddress'];
     $this->assertTrue($accounts[0]->save());
     $john = User::getByUsername('john');
     $john->primaryEmail->emailAddress = Yii::app()->params['emailTestAccounts']['testEmailAddress'];
     $this->assertTrue($john->save());
     EmailMessage::deleteAll();
     Yii::app()->imap->deleteMessages(true);
     // Check if there are no emails in dropbox
     $job = new EmailArchivingJob();
     $this->assertTrue($job->run());
     $this->assertEquals(0, EmailMessage::getCount());
     $imapStats = Yii::app()->imap->getMessageBoxStatsDetailed();
     $this->assertEquals(0, $imapStats->Nmsgs);
     //Now user send email to another user, and to dropbox
     $pathToFiles = Yii::getPathOfAlias('application.modules.emailMessages.tests.unit.files');
     Yii::app()->emailHelper->sendRawEmail("Email from Steve 3", $user->primaryEmail->emailAddress, array(Yii::app()->params['emailTestAccounts']['testEmailAddress']), 'Email from Steve', '<strong>Email</strong> from Steve', null, array(Yii::app()->imap->imapUsername), null, self::$userMailer);
     sleep(30);
     $job = new EmailArchivingJob();
     $this->assertTrue($job->run());
     $imapStats = Yii::app()->imap->getMessageBoxStatsDetailed();
     $this->assertEquals(0, $imapStats->Nmsgs);
     $this->assertEquals(2, EmailMessage::getCount());
     $emailMessages = EmailMessage::getAll();
     $emailMessage = $emailMessages[1];
     $this->assertEquals('Email from Steve 3', $emailMessage->subject);
     $this->assertEquals('Email from Steve', trim($emailMessage->content->textContent));
     $this->assertEquals('<!-- zurmo css inline --><strong>Email</strong> from Steve', preg_replace("/\r|\n/", "", $emailMessage->content->htmlContent));
     $this->assertEquals($user->primaryEmail->emailAddress, $emailMessage->sender->fromAddress);
     $this->assertEquals(1, count($emailMessage->recipients));
     $recipient = $emailMessage->recipients[0];
     $this->assertCount(3, $recipient->personsOrAccounts);
     $this->assertEquals($recipient->toAddress, Yii::app()->params['emailTestAccounts']['testEmailAddress']);
     $this->assertEquals(EmailMessageRecipient::TYPE_TO, $recipient->type);
     $this->assertEquals(EmailFolder::TYPE_ARCHIVED, $emailMessage->folder->type);
     $job = new EmailArchivingJob();
     $this->assertTrue($job->run());
     $imapStats = Yii::app()->imap->getMessageBoxStatsDetailed();
     $this->assertEquals(0, $imapStats->Nmsgs);
     $this->assertEquals(2, EmailMessage::getCount());
     $this->assertEquals(1, Notification::getCountByTypeAndUser('EmailMessageArchivingEmailAddressNotMatching', $user));
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:59,代码来源:EmailArchivingJobTest.php


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