Beispiel #1
0
 public function __construct(StreamItemObjectBuilder $builder)
 {
     parent::__construct($builder->getObjectID());
     $this->owner = $builder->getOwner();
     $this->author = $builder->getAuthor();
     $this->datetime = $builder->getDatetime();
     $this->activity = $builder->getActivity();
     $this->signature = $builder->getSignature();
 }
Beispiel #2
0
    public function testStream()
    {
        $streamItem = (new StreamItemObjectBuilder())->objectID(UOID::createUOID())->owner(Sonic::getContextGlobalID())->author(Sonic::getContextGlobalID())->datetime()->activity(new JSONObject('{"@context": "http://www.w3.org/ns/activitystreams",
				"type": "Activity",
				"actor":
				{
					"type": "Person",
					"displayName": "Alice"
				},
				"object":
				{
					"type": "Note",
					"displayName": "A Note"
				}
			}'))->build();
        $this->assertTrue($streamItem->validate());
        $this->assertEquals($streamItem, StreamItemObjectBuilder::buildFromJSON($streamItem->getJSONString()));
    }