Test for correct post object in retweets.

This commit is contained in:
Roger Braun 2016-12-04 16:19:59 +01:00 committed by Mikael Nordfeldth
parent c5a4921176
commit 8c6c6039a2

View File

@ -15,6 +15,35 @@ require_once INSTALLDIR . '/lib/common.php';
class ActivityParseTests extends PHPUnit_Framework_TestCase class ActivityParseTests extends PHPUnit_Framework_TestCase
{ {
public function testMastodonRetweet() {
global $_mastodon_retweet;
$dom = DOMDocument::loadXML($_mastodon_retweet);
$feed = $dom->documentElement;
$entries = $feed->getElementsByTagName('entry');
$entry = $entries->item(0);
$act = new Activity($entry, $feed);
$this->assertFalse(empty($act));
$this->assertFalse(empty($act->objects[0]));
$object = $act->objects[0];
$this->assertEquals($object->verb, ActivityVerb::POST);
}
public function testGSReweet() {
global $_gs_retweet;
$dom = DOMDocument::loadXML($_gs_retweet);
$feed = $dom->documentElement;
$entries = $feed->getElementsByTagName('entry');
$entry = $entries->item(0);
$act = new Activity($entry, $feed);
$this->assertFalse(empty($act));
$this->assertFalse(empty($act->objects[0]));
$object = $act->objects[0];
$this->assertEquals($object->verb, ActivityVerb::POST);
}
public function testExample1() public function testExample1()
{ {
global $_example1; global $_example1;