$actor = ActivityUtils::child($element, 'actor', Activity::SPEC);
$this->assertFalse(is_null($author));
- $this->assertFalse(is_null($actor));
+ $this->assertTrue(is_null($actor)); // <activity:actor> is obsolete, no longer added
}
public function testAuthorContent()
$this->assertEquals($this->author1->uri, ActivityUtils::childContent($author, 'uri'));
}
+ /**
+ * We no longer create <activity:actor> entries, they have merged to <atom:author>
+ */
public function testActorContent()
{
$notice = $this->_fakeNotice();
$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()
$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()
$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()
$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()
$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()