Пример #1
0
 public function __construct(LinkResponseObjectBuilder $builder)
 {
     parent::__construct($builder->getObjectID(), $builder->getTargetID());
     $this->setAccept($builder->getAccept());
     $this->setLink($builder->getLink());
     $this->setDatetime($builder->getDatetime());
     $this->setMessage($builder->getMessage());
 }
Пример #2
0
 public function testLink()
 {
     $link = (new LinkObjectBuilder())->objectID(UOID::createUOID())->link(Sonic::getContextGlobalID())->owner($this->bobSocialRecord->getGlobalID())->build();
     $this->assertTrue($link->validate());
     $this->assertEquals($link, LinkObjectBuilder::buildFromJSON($link->getJSONString()));
     $linkRoster = (new LinkRosterObjectBuilder())->objectID(UOID::createUOID())->owner(Sonic::getContextGlobalID())->roster(array($link))->build();
     $this->assertTrue($linkRoster->validate());
     $this->assertEquals($linkRoster, LinkRosterObjectBuilder::buildFromJSON($linkRoster->getJSONString()));
     $linkRequest = (new LinkRequestObjectBuilder())->objectID(UOID::createUOID())->initiatingGID(Sonic::getContextGlobalID())->targetedGID($this->bobSocialRecord->getGlobalID())->message('testMessage')->build();
     $this->assertTrue($linkRequest->validate());
     $this->assertEquals($linkRequest, LinkRequestObjectBuilder::buildFromJSON($linkRequest->getJSONString()));
     $linkResponse = (new LinkResponseObjectBuilder())->objectID(UOID::createUOID())->targetID(UOID::createUOID())->accept(true)->message('testMessage')->link($link)->build();
     $this->assertTrue($linkResponse->validate());
     $this->assertEquals($linkResponse, LinkResponseObjectBuilder::buildFromJSON($linkResponse->getJSONString()));
 }