public function __construct(ConversationObjectBuilder $builder)
 {
     parent::__construct($builder->getObjectID());
     $this->title = $builder->getTitle();
     $this->owner = $builder->getOwner();
     $this->datetime = $builder->getDatetime();
     $this->members = $builder->getMembers();
     asort($this->members);
     $this->signature = $builder->getSignature();
 }
Exemple #2
0
 public function testConversation()
 {
     $conversationUOID = UOID::createUOID();
     $messageUOID = UOID::createUOID();
     $conversation = (new ConversationObjectBuilder())->objectID($conversationUOID)->owner(Sonic::getContextGlobalID())->members(array(Sonic::getContextGlobalID(), $this->bobSocialRecord->getGlobalID()))->title('conversation title')->build();
     $this->assertTrue($conversation->validate());
     $this->assertEquals($conversation, ConversationObjectBuilder::buildFromJSON($conversation->getJSONString()), "\$canonicalize = true", $delta = 0.0, $maxDepth = 10, $canonicalize = true);
     $conversationMessage = (new ConversationMessageObjectBuilder())->objectID($messageUOID)->targetID($conversationUOID)->title('message title')->author(Sonic::getContextGlobalID())->body('message text')->datetime()->build();
     $conversationMessage->setStatus(ConversationMessageStatusObject::STATUS_READ);
     $this->assertTrue($conversationMessage->validate());
     $this->assertEquals($conversationMessage, ConversationMessageObjectBuilder::buildFromJSON($conversationMessage->getJSONString()));
     $conversationStatus = (new ConversationStatusObjectBuilder())->targetID($conversationUOID)->status(ConversationStatusObject::STATUS_INVITED)->author(Sonic::getContextGlobalID())->targetGID($this->bobSocialRecord->getGlobalID())->datetime()->build();
     $this->assertTrue($conversationStatus->validate());
     $this->assertEquals($conversationStatus, ConversationStatusObjectBuilder::buildFromJSON($conversationStatus->getJSONString()));
     $conversationMessageStatus = (new ConversationMessageStatusObjectBuilder())->targetID($messageUOID)->conversationID($conversationUOID)->status(ConversationMessageStatusObject::STATUS_READ)->author(Sonic::getContextGlobalID())->build();
     $this->assertTrue($conversationMessageStatus->validate());
     $this->assertEquals($conversationMessageStatus, ConversationMessageStatusObjectBuilder::buildFromJSON($conversationMessageStatus->getJSONString()));
 }