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


PHP Conversation::getAll方法代码示例

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


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

示例1: createAndSaveNewConversationForUser

 protected function createAndSaveNewConversationForUser(User $owner, User $participant)
 {
     foreach (Conversation::getAll() as $conversation) {
         $conversation->delete();
     }
     $conversation = new Conversation();
     $conversation->owner = $owner;
     $conversation->subject = 'My test conversation subject';
     $conversation->description = 'My test conversation description';
     $conversationParticipant = new ConversationParticipant();
     $conversationParticipant->person = $participant;
     $conversation->conversationParticipants->add($conversationParticipant);
     $this->assertTrue($conversation->save());
     return $conversation;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:15,代码来源:ConversationsMashableInboxRulesTest.php

示例2: testDeleteConversation

 /**
  * @depends testGetUnreadConversationCount
  */
 public function testDeleteConversation()
 {
     $conversations = Conversation::getAll();
     $this->assertEquals(3, count($conversations));
     $comments = Comment::getAll();
     $this->assertEquals(4, count($comments));
     //check count of conversation_items
     $count = ZurmoRedBean::getRow('select count(*) count from conversation_item');
     $this->assertEquals(2, $count['count']);
     //remove the account, tests tthat ConversationObserver is correctly removing data from conversation_item
     $accounts = Account::getByName('anAccount2');
     $this->assertTrue($accounts[0]->delete());
     $count = ZurmoRedBean::getRow('select count(*) count from conversation_item');
     $this->assertEquals(1, $count['count']);
     foreach ($conversations as $conversation) {
         $conversationId = $conversation->id;
         $conversation->forget();
         $conversation = Conversation::getById($conversationId);
         $deleted = $conversation->delete();
         $this->assertTrue($deleted);
     }
     //Count of conversation items should be 0 since the ConversationsObserver should make sure it gets removed correctly.
     $count = ZurmoRedBean::getRow('select count(*) count from conversation_item');
     $this->assertEquals(0, $count['count']);
     //check that all comments are removed, since they are owned.
     $comments = Comment::getAll();
     $this->assertEquals(0, count($comments));
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:31,代码来源:ConversationTest.php

示例3: testSendEmailInNewComment

 /**
  * @depends testClosingConversations
  */
 public function testSendEmailInNewComment()
 {
     if (!SECURITY_OPTIMIZED) {
         return;
     }
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $steven = User::getByUsername('steven');
     $sally = User::getByUsername('sally');
     $mary = User::getByUsername('mary');
     $conversations = Conversation::getAll();
     $this->assertEquals(2, count($conversations));
     $this->assertEquals(0, $conversations[0]->comments->count());
     foreach (EmailMessage::getAll() as $emailMessage) {
         $emailMessage->delete();
     }
     $initialQueued = 0;
     $conversation = $conversations[0];
     $conversationParticipant = new ConversationParticipant();
     $conversationParticipant->person = $steven;
     $conversation->conversationParticipants->add($conversationParticipant);
     $conversationParticipant = new ConversationParticipant();
     $conversationParticipant->person = $sally;
     $conversation->conversationParticipants->add($conversationParticipant);
     $conversationParticipant = new ConversationParticipant();
     $conversationParticipant->person = $mary;
     $conversation->conversationParticipants->add($conversationParticipant);
     $inboxAndEmailNotificationSettings = UserTestHelper::getDefaultNotificationSettingsValuesForTestUser();
     $inboxAndEmailNotificationSettings['enableConversationNewCommentNotification'] = array('inbox' => false, 'email' => false);
     UserNotificationUtil::setValue($mary, $inboxAndEmailNotificationSettings, 'inboxAndEmailNotificationSettings', false);
     //Save a new comment
     $this->setGetArray(array('relatedModelId' => $conversation->id, 'relatedModelClassName' => 'Conversation', 'relatedModelRelationName' => 'comments', 'redirectUrl' => 'someRedirect'));
     $this->setPostArray(array('Comment' => array('description' => 'a ValidComment Name')));
     $this->runControllerWithRedirectExceptionAndGetContent('comments/default/inlineCreateSave');
     $this->assertEquals(1, $conversation->comments->count());
     $this->assertEquals($initialQueued + 2, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     $emailMessages = EmailMessage::getAll();
     $emailMessage = $emailMessages[$initialQueued];
     $this->assertEquals(1, count($emailMessage->recipients));
     $emailMessage = $emailMessages[$initialQueued + 1];
     $this->assertEquals(1, count($emailMessage->recipients));
     $this->assertContains('conversation', $emailMessage->subject);
     $this->assertContains(strval($conversation), $emailMessage->subject);
     $this->assertContains(strval($conversation->comments[0]), $emailMessage->content->htmlContent);
     $this->assertContains(strval($conversation->comments[0]), $emailMessage->content->textContent);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:49,代码来源:ConversationsUserWalkthroughTest.php


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