public function __construct(SearchResultCollectionObjectBuilder $builder)
 {
     parent::__construct($builder->getObjectID(), $builder->getTargetID());
     $this->setPlatformGID($builder->getPlatformGID());
     $this->setDatetime($builder->getDatetime());
     $this->addResultArray($builder->getResults());
 }
Ejemplo n.º 2
0
 public function testSearch()
 {
     $searchQuery = (new SearchQueryObjectBuilder())->initiatingGID(Sonic::getContextGlobalID())->query((new ESQueryBuilder())->type('profile')->match('displayName', 'alice')->build())->datetime()->build();
     $this->assertTrue($searchQuery->validate());
     $this->assertEquals($searchQuery, SearchQueryObjectBuilder::buildFromJSON($searchQuery->getJSONString()));
     $profile = (new ProfileObjectBuilder())->globalID(Sonic::getContextGlobalID())->displayName($this->aliceSocialRecord->getDisplayName())->param('x', 'y')->build();
     $searchResult = (new SearchResultObjectBuilder())->targetID($searchQuery->getObjectID())->resultOwnerGID($profile->getGlobalID())->resultObjectID($profile->getObjectID())->resultIndex($searchQuery->getQuery()->getIndex())->resultType($searchQuery->getQuery()->getType())->displayName($profile->getDisplayName())->datetime()->build();
     $this->assertTrue($searchResult->validate());
     $this->assertEquals($searchResult, SearchResultObjectBuilder::buildFromJSON($searchResult->getJSONString()));
     $searchResultCollection = (new SearchResultCollectionObjectBuilder())->objectID(UOID::createUOID($this->platformSocialRecord->getGlobalID()))->targetID($searchQuery->getObjectID())->platformGID($this->platformSocialRecord->getGlobalID())->datetime()->result($searchResult)->build();
     $this->assertTrue($searchResultCollection->validate());
     $this->assertEquals($searchResultCollection, SearchResultCollectionObjectBuilder::buildFromJSON($searchResultCollection->getJSONString()));
 }