From 543ff40ef62f2587cde084b03bcf2e956f52ce2f Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 24 Feb 2010 16:51:24 -0800 Subject: Populate more profile information when doing a remote subscribe --- tests/ActivityParseTests.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/ActivityParseTests.php b/tests/ActivityParseTests.php index 5de97d2e2..d1d871734 100644 --- a/tests/ActivityParseTests.php +++ b/tests/ActivityParseTests.php @@ -133,6 +133,8 @@ class ActivityParseTests extends PHPUnit_Framework_TestCase $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'); + } } -- cgit v1.2.3-54-g00ecf From 8274bbedcf1d8b08682c6f2ee96cc0f6a3c7e293 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 25 Feb 2010 19:17:50 -0800 Subject: Fix test to account for new way avatars are stored in ActivityObject --- tests/ActivityParseTests.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/ActivityParseTests.php b/tests/ActivityParseTests.php index d1d871734..7bf9cec7c 100644 --- a/tests/ActivityParseTests.php +++ b/tests/ActivityParseTests.php @@ -121,10 +121,14 @@ class ActivityParseTests extends PHPUnit_Framework_TestCase $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( - $act->actor->avatar, - 'http://example.net/mysite/avatar/3-96-20100224004207.jpeg' + $avatars[0]->url, + 'http://example.net/mysite/avatar/3-96-20100224004207.jpeg' ); + $this->assertEquals($act->actor->displayName, 'Test User'); $poco = $act->actor->poco; -- cgit v1.2.3-54-g00ecf From 0e360ad23da4404c47bdb074a1afdb2eed873ecd Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 3 Mar 2010 20:07:13 -0800 Subject: Test a small user feed to ensure we're taking the activity actor from the subject --- tests/UserFeedParseTest.php | 131 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 tests/UserFeedParseTest.php (limited to 'tests') diff --git a/tests/UserFeedParseTest.php b/tests/UserFeedParseTest.php new file mode 100644 index 000000000..b3f9a6417 --- /dev/null +++ b/tests/UserFeedParseTest.php @@ -0,0 +1,131 @@ +assertFalse(empty($dom)); + + $entries = $dom->getElementsByTagName('entry'); + + $entry1 = $entries->item(0); + $this->assertFalse(empty($entry1)); + + $feedEl = $dom->getElementsByTagName('feed')->item(0); + $this->assertFalse(empty($feedEl)); + + // Test actor (from activity:subject) + + $act1 = new Activity($entry1, $feedEl); + $this->assertFalse(empty($act1)); + $this->assertFalse(empty($act1->actor)); + $this->assertEquals($act1->actor->type, ActivityObject::PERSON); + $this->assertEquals($act1->actor->title, 'Zach Copley'); + $this->assertEquals($act1->actor->id, 'http://localhost/statusnet/user/1'); + $this->assertEquals($act1->actor->link, 'http://localhost/statusnet/zach'); + + $avatars = $act1->actor->avatarLinks; + + $this->assertEquals( + $avatars[0]->url, + 'http://localhost/statusnet/theme/default/default-avatar-profile.png' + ); + + $this->assertEquals( + $avatars[1]->url, + 'http://localhost/statusnet/theme/default/default-avatar-stream.png' + ); + + $this->assertEquals( + $avatars[2]->url, + 'http://localhost/statusnet/theme/default/default-avatar-mini.png' + ); + + $this->assertEquals($act1->actor->displayName, 'Zach Copley'); + + $poco = $act1->actor->poco; + $this->assertEquals($poco->preferredUsername, 'zach'); + $this->assertEquals($poco->address->formatted, 'El Cerrito, CA'); + $this->assertEquals($poco->urls[0]->type, 'homepage'); + $this->assertEquals($poco->urls[0]->value, 'http://zach.copley.name'); + $this->assertEquals($poco->urls[0]->primary, 'true'); + $this->assertEquals($poco->note, 'Zach Hack Attack'); + + // test the post + + //var_export($act1); + $this->assertEquals($act1->object->type, 'http://activitystrea.ms/schema/1.0/note'); + $this->assertEquals($act1->object->title, 'And now for something completely insane...'); + + $this->assertEquals($act1->object->content, 'And now for something completely insane...'); + $this->assertEquals($act1->object->id, 'http://localhost/statusnet/notice/3'); + + } + +} + +$_testfeed1 = << + + http://localhost/statusnet/api/statuses/user_timeline/1.atom + zach timeline + Updates from zach on Zach Dev! + http://localhost/statusnet/theme/default/default-avatar-profile.png + 2010-03-04T01:41:14+00:00 + + zach + http://localhost/statusnet/user/1 + + + + + + + + + + http://activitystrea.ms/schema/1.0/person + http://localhost/statusnet/user/1 + Zach Copley + + + + + +zach +Zach Copley +Zach Hack Attack + + El Cerrito, CA + + + homepage + http://zach.copley.name + true + + + + + And now for something completely insane... + + http://localhost/statusnet/notice/3 + 2010-03-04T01:41:07+00:00 + 2010-03-04T01:41:07+00:00 + + And now for something completely insane... + + + +TESTFEED1; -- cgit v1.2.3-54-g00ecf