documentElement);
$this->assertFalse(empty($act));
$this->assertEquals($act->time, 1243860840);
$this->assertEquals($act->verb, ActivityVerb::POST);
$this->assertFalse(empty($act->object));
$this->assertEquals($act->object->title, 'Punctuation Changeset');
$this->assertEquals($act->object->type, 'http://versioncentral.example.org/activity/changeset');
$this->assertEquals($act->object->summary, 'Fixing punctuation because it makes it more readable.');
$this->assertEquals($act->object->id, 'tag:versioncentral.example.org,2009:/change/1643245');
}
public function testExample3()
{
global $_example3;
$dom = DOMDocument::loadXML($_example3);
$feed = $dom->documentElement;
$entries = $feed->getElementsByTagName('entry');
$entry = $entries->item(0);
$act = new Activity($entry, $feed);
$this->assertFalse(empty($act));
$this->assertEquals($act->time, 1071340202);
$this->assertEquals($act->link, 'http://example.org/2003/12/13/atom03.html');
$this->assertEquals($act->verb, ActivityVerb::POST);
$this->assertFalse(empty($act->actor));
$this->assertEquals($act->actor->type, ActivityObject::PERSON);
$this->assertEquals($act->actor->title, 'John Doe');
$this->assertEquals($act->actor->id, 'mailto:johndoe@example.com');
$this->assertFalse(empty($act->object));
$this->assertEquals($act->object->type, ActivityObject::NOTE);
$this->assertEquals($act->object->id, 'urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a');
$this->assertEquals($act->object->title, 'Atom-Powered Robots Run Amok');
$this->assertEquals($act->object->summary, 'Some text.');
$this->assertEquals($act->object->link, 'http://example.org/2003/12/13/atom03.html');
$this->assertFalse(empty($act->context));
$this->assertTrue(empty($act->target));
$this->assertEquals($act->entry, $entry);
$this->assertEquals($act->feed, $feed);
}
public function testExample4()
{
global $_example4;
$dom = DOMDocument::loadXML($_example4);
$entry = $dom->documentElement;
$act = new Activity($entry);
$this->assertFalse(empty($act));
$this->assertEquals(1266547958, $act->time);
$this->assertEquals('http://example.net/notice/14', $act->link);
$this->assertFalse(empty($act->context));
$this->assertEquals('http://example.net/notice/12', $act->context->replyToID);
$this->assertEquals('http://example.net/notice/12', $act->context->replyToUrl);
$this->assertEquals('http://example.net/conversation/11', $act->context->conversation);
$this->assertEquals(array('http://example.net/user/1'), $act->context->attention);
$this->assertFalse(empty($act->object));
$this->assertEquals($act->object->content,
'@evan now is the time for all good men to come to the aid of their country. #thetime');
$this->assertFalse(empty($act->actor));
}
public function testExample5()
{
global $_example5;
$dom = DOMDocument::loadXML($_example5);
$feed = $dom->documentElement;
// @todo Test feed elements
$entries = $feed->getElementsByTagName('entry');
$entry = $entries->item(0);
$act = new Activity($entry, $feed);
// Post
$this->assertEquals($act->verb, ActivityVerb::POST);
$this->assertFalse(empty($act->context));
// Actor w/Portable Contacts stuff
$this->assertFalse(empty($act->actor));
$this->assertEquals($act->actor->type, ActivityObject::PERSON);
$this->assertEquals($act->actor->title, 'Test User');
$this->assertEquals($act->actor->id, 'http://example.net/mysite/user/3');
$this->assertEquals($act->actor->link, 'http://example.net/mysite/testuser');
$avatars = $act->actor->avatarLinks;
$this->assertEquals(
$avatars[0]->url,
'http://example.net/mysite/avatar/3-96-20100224004207.jpeg'
);
$this->assertEquals($act->actor->displayName, 'Test User');
$poco = $act->actor->poco;
$this->assertEquals($poco->preferredUsername, 'testuser');
$this->assertEquals($poco->address->formatted, 'San Francisco, CA');
$this->assertEquals($poco->urls[0]->type, 'homepage');
$this->assertEquals($poco->urls[0]->value, 'http://example.com/blog.html');
$this->assertEquals($poco->urls[0]->primary, 'true');
$this->assertEquals($act->actor->geopoint, '37.7749295 -122.4194155');
}
public function testExample6()
{
global $_example6;
$dom = DOMDocument::loadXML($_example6);
$rss = $dom->documentElement;
$channels = $dom->getElementsByTagName('channel');
$channel = $channels->item(0);
$items = $channel->getElementsByTagName('item');
$item = $items->item(0);
$act = new Activity($item, $channel);
$this->assertEquals($act->verb, ActivityVerb::POST);
$this->assertEquals($act->id, 'http://en.blog.wordpress.com/?p=3857');
$this->assertEquals($act->link, 'http://en.blog.wordpress.com/2010/03/03/rub-a-dub-dub-in-the-pubsubhubbub/');
$this->assertEquals($act->title, 'Rub-a-Dub-Dub in the PubSubHubbub');
$this->assertEquals($act->time, 1267634892);
$actor = $act->actor;
$this->assertFalse(empty($actor));
$this->assertEquals($actor->title, "Joseph Scott");
}
}
$_example1 = <<
Today we’ve turned on PuSH support for the more than 10.5 million blogs on WordPress.com. There’s nothing to configure, it’s working right now behind the scenes to help others keep up to date with your posts.
For those using the WordPress.org software we are releasing a new PuSH plugin: PuSHPress. This plugin differs from the current PuSH related plugins by including a built-in hub.
For more PuSH related reading check out the PubSubHubbub project site and Google Group. And if you really want to geek out there’s always the PubSubHubbub Spec