Пример #1
0
    public function testStream()
    {
        $image = new Object();
        $image->setHeight(32);
        $image->setWidth(32);
        $author = new Object();
        $author->setDisplayName('Internal TW Admin user');
        $author->setId('tw_admin');
        $author->setImage($image);
        $author->setObjectType('PERSON');
        $item = new Object();
        $item->setAuthor($author);
        $item->setContent('tagging Internal TW Admin user user');
        $item->setObjectType('COMMENT');
        $item->setPublished(new DateTime('2012-01-09T16:18:44+00:00'));
        $replies = new Collection();
        $replies->setItems([$item]);
        $actor = new Object();
        $actor->setId('tw_admin');
        $actor->setDisplayName('Internal TW Admin user');
        $actor->setObjectType('PERSON');
        $object = new Object();
        $object->setDisplayName('Task: Submit requisition');
        $object->setId('2078.3');
        $object->setObjectType('ibm.bpm.task');
        $activity = new Activity();
        $activity->setActor($actor);
        $activity->setContent('Internal TW Admin user completed the task titled Task: Submit requisition and associated with the Submit job requisition activity.');
        $activity->setObject($object);
        $activity->setPublished(new DateTime('2012-01-09T09:58:00+00:00'));
        $activity->setVerb('POST');
        $activity->setReplies($replies);
        $collection = new Collection();
        $collection->setTotalItems(1);
        $collection->setItems([$activity]);
        $content = <<<JSON
{
    "totalItems":1,
    "items":[
        {
            "actor":{
                "displayName":"Internal TW Admin user",
                "id":"tw_admin",
                "objectType":"PERSON"
            },
            "content":"Internal TW Admin user completed the task titled Task: Submit requisition and associated with the Submit job requisition activity.",
            "object":{
                "displayName":"Task: Submit requisition",
                "id":"2078.3",
                "objectType":"ibm.bpm.task"
            },
            "published":"2012-01-09T09:58:00Z",
            "verb":"POST",
            "replies":{
                "items":[
                    {
                        "author":{
                            "displayName":"Internal TW Admin user",
                            "id":"tw_admin",
                            "image":{
                                "height":32,
                                "width":32
                            },
                            "objectType":"PERSON"
                        },
                        "content":"tagging Internal TW Admin user user",
                        "objectType":"COMMENT",
                        "published":"2012-01-09T16:18:44Z"
                    }
                ]
            }
        }
    ]
}
JSON;
        $this->assertRecordEqualsContent($collection, $content);
    }