]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Test for correct post object in retweets.
authorRoger Braun <roger@rogerbraun.net>
Sun, 4 Dec 2016 15:19:59 +0000 (16:19 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 5 Dec 2016 17:24:13 +0000 (18:24 +0100)
tests/ActivityParseTests.php

index 90d214c54d6f1042d8f9b9b4b64f9e470c59b5a0..566318e9eab5629e9517598c2972612c9424aa07 100644 (file)
@@ -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;