public function __construct(ConversationMessageStatusObjectBuilder $builder)
 {
     parent::__construct($builder->getObjectID(), $builder->getTargetID());
     $this->conversationID = $builder->getConversationID();
     $this->status = $builder->getStatus();
     $this->author = $builder->getAuthor();
     $this->datetime = $builder->getDatetime();
     $this->signature = $builder->getSignature();
 }
示例#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()));
 }