From 8c6c6039a28906bdcbefa86029d6be0b1dc697ae Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sun, 4 Dec 2016 16:19:59 +0100 Subject: [PATCH] Test for correct post object in retweets. --- tests/ActivityParseTests.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/ActivityParseTests.php b/tests/ActivityParseTests.php index 90d214c54d..566318e9ea 100644 --- a/tests/ActivityParseTests.php +++ b/tests/ActivityParseTests.php @@ -15,6 +15,35 @@ require_once INSTALLDIR . '/lib/common.php'; 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() { global $_example1; -- 2.39.5