From cb4f27100267ed6dd6d7619a8a583196932d3e5d Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 30 May 2011 10:04:25 -0400 Subject: [PATCH] test to check that Bookmark related links are appearing correctly --- tests/ActivityParseTests.php | 109 +++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/tests/ActivityParseTests.php b/tests/ActivityParseTests.php index c2817a4602..6423eaaf03 100644 --- a/tests/ActivityParseTests.php +++ b/tests/ActivityParseTests.php @@ -405,6 +405,28 @@ class ActivityParseTests extends PHPUnit_Framework_TestCase $act = new Activity($entry, $feed); $this->assertEquals($act->actor->id, $expected); } + + public function testBookmarkRelated() + { + global $_example11; + $dom = new DOMDocument(); + $dom->loadXML($_example11); + + $feed = $dom->documentElement; + $entry = $dom->getElementsByTagName('entry')->item(0); + + $expected = 'http://blog.teambox.com/open-source-companies'; + + $links = ActivityUtils::getLinks($entry, 'related'); + + $this->assertFalse(empty($links)); + $this->assertTrue(is_array($links)); + $this->assertEquals(count($links), 1); + + $url = $links[0]->getAttribute('href'); + + $this->assertEquals($url, $expected); + } } $_example1 = << EXAMPLE10; + +$_example11 = << + + StatusNet + http://freelish.us/api/statuses/user_timeline/1.atom + demon timeline + Updates from demon on freelish.us! + http://avatar.status.net/f/freelishus/1-96-20110331163048.jpeg + 2011-05-30T09:36:03-04:00 + + http://activitystrea.ms/schema/1.0/person + http://freelishus.status.net/user/1 + demon + + + + + + 45.50884 -73.58781 + demon + Evan Prodromou + Montreal hacker and entrepreneur. + + Montreal, Quebec + + + + homepage + http://evan.status.net/ + true + + + + + + http://activitystrea.ms/schema/1.0/person + http://freelishus.status.net/user/1 + Evan Prodromou + + + + + + 45.50884 -73.58781 + demon + Evan Prodromou + Montreal hacker and entrepreneur. + + Montreal, Quebec + + + + homepage + http://evan.status.net/ + true + + + + + + + + + + + + + + http://activitystrea.ms/schema/1.0/bookmark + http://freelish.us/bookmark/9e930c3e-7ed9-47de-aba5-df6c60cec542 + Why you should build an open-source startup | Teambox Blog + + + http://activitystrea.ms/schema/1.0/post + 2011-05-26T20:36:25+00:00 + 2011-05-26T20:36:25+00:00 + + + + + + + + + +EXAMPLE11;