X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2FActivityGenerationTests.php;h=8cf1b009ed6ed5379e98d68c6d0e50f5b6d20a52;hb=70fbdb6f94848c5c08b0b6e30905d875156b8233;hp=52077ee570334449f24b9c2aae55d668d061490d;hpb=2ba36fc2428ed41d74e123d49de38accc48415e3;p=quix0rs-gnu-social.git diff --git a/tests/ActivityGenerationTests.php b/tests/ActivityGenerationTests.php index 52077ee570..8cf1b009ed 100644 --- a/tests/ActivityGenerationTests.php +++ b/tests/ActivityGenerationTests.php @@ -194,7 +194,7 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase $actor = ActivityUtils::child($element, 'actor', Activity::SPEC); $this->assertFalse(is_null($author)); - $this->assertFalse(is_null($actor)); + $this->assertTrue(is_null($actor)); // is obsolete, no longer added } public function testAuthorContent() @@ -213,6 +213,9 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase $this->assertEquals($this->author1->uri, ActivityUtils::childContent($author, 'uri')); } + /** + * We no longer create entries, they have merged to + */ public function testActorContent() { $notice = $this->_fakeNotice(); @@ -225,8 +228,7 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase $actor = ActivityUtils::child($element, 'actor', Activity::SPEC); - $this->assertEquals($this->author1->uri, ActivityUtils::childContent($actor, 'id')); - $this->assertEquals($this->author1->nickname, ActivityUtils::childContent($actor, 'title')); + $this->assertEquals($actor, null); } public function testReplyLink() @@ -261,6 +263,7 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase $element = $this->_entryToElement($entry, true); $this->assertEquals($this->targetUser1->uri, ActivityUtils::getLink($element, 'ostatus:attention')); + $this->assertEquals($this->targetUser1->uri, ActivityUtils::getLink($element, 'mentioned')); } public function testMultipleReplyAttention() @@ -291,6 +294,19 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase $this->assertTrue(in_array($this->targetUser1->uri, $hrefs)); $this->assertTrue(in_array($this->targetUser2->uri, $hrefs)); + + $links = ActivityUtils::getLinks($element, 'mentioned'); + + $this->assertEquals(2, count($links)); + + $hrefs = array(); + + foreach ($links as $link) { + $hrefs[] = $link->getAttribute('href'); + } + + $this->assertTrue(in_array($this->targetUser1->uri, $hrefs)); + $this->assertTrue(in_array($this->targetUser2->uri, $hrefs)); } public function testGroupPostAttention() @@ -304,6 +320,7 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase $element = $this->_entryToElement($entry, true); $this->assertEquals($this->targetGroup1->uri, ActivityUtils::getLink($element, 'ostatus:attention')); + $this->assertEquals($this->targetGroup1->uri, ActivityUtils::getLink($element, 'mentioned')); } public function testMultipleGroupPostAttention() @@ -328,6 +345,19 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase $this->assertTrue(in_array($this->targetGroup1->uri, $hrefs)); $this->assertTrue(in_array($this->targetGroup2->uri, $hrefs)); + + $links = ActivityUtils::getLinks($element, 'mentioned'); + + $this->assertEquals(2, count($links)); + + $hrefs = array(); + + foreach ($links as $link) { + $hrefs[] = $link->getAttribute('href'); + } + + $this->assertTrue(in_array($this->targetGroup1->uri, $hrefs)); + $this->assertTrue(in_array($this->targetGroup2->uri, $hrefs)); } public function testRepeatLink()