diff options
Diffstat (limited to 'tests')
26 files changed, 1159 insertions, 25 deletions
diff --git a/tests/ActivityGenerationTests.php b/tests/ActivityGenerationTests.php new file mode 100644 index 000000000..b9e74a570 --- /dev/null +++ b/tests/ActivityGenerationTests.php @@ -0,0 +1,592 @@ +<?php + +if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { + print "This script must be run from the command line\n"; + exit(); +} + +// XXX: we should probably have some common source for this stuff + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); +define('STATUSNET', true); + +require_once INSTALLDIR . '/lib/common.php'; + +class ActivityGenerationTests extends PHPUnit_Framework_TestCase +{ + var $author1 = null; + var $author2 = null; + + var $targetUser1 = null; + var $targetUser2 = null; + + var $targetGroup1 = null; + var $targetGroup2 = null; + + function __construct() + { + parent::__construct(); + + $authorNick1 = 'activitygenerationtestsuser' . common_good_rand(4); + $authorNick2 = 'activitygenerationtestsuser' . common_good_rand(4); + + $targetNick1 = 'activitygenerationteststarget' . common_good_rand(4); + $targetNick2 = 'activitygenerationteststarget' . common_good_rand(4); + + $groupNick1 = 'activitygenerationtestsgroup' . common_good_rand(4); + $groupNick2 = 'activitygenerationtestsgroup' . common_good_rand(4); + + $this->author1 = User::register(array('nickname' => $authorNick1, + 'email' => $authorNick1 . '@example.net', + 'email_confirmed' => true)); + + $this->author2 = User::register(array('nickname' => $authorNick2, + 'email' => $authorNick2 . '@example.net', + 'email_confirmed' => true)); + + $this->targetUser1 = User::register(array('nickname' => $targetNick1, + 'email' => $targetNick1 . '@example.net', + 'email_confirmed' => true)); + + $this->targetUser2 = User::register(array('nickname' => $targetNick2, + 'email' => $targetNick2 . '@example.net', + 'email_confirmed' => true)); + + $this->targetGroup1 = User_group::register(array('nickname' => $groupNick1, + 'userid' => $this->author1->id, + 'aliases' => array(), + 'local' => true, + 'location' => null, + 'description' => null, + 'fullname' => null, + 'homepage' => null, + 'mainpage' => null)); + $this->targetGroup2 = User_group::register(array('nickname' => $groupNick2, + 'userid' => $this->author1->id, + 'aliases' => array(), + 'local' => true, + 'location' => null, + 'description' => null, + 'fullname' => null, + 'homepage' => null, + 'mainpage' => null)); + } + + public function testBasicNoticeActivity() + { + $notice = $this->_fakeNotice(); + + $entry = $notice->asAtomEntry(true); + + $element = $this->_entryToElement($entry, false); + + $this->assertEquals($notice->uri, ActivityUtils::childContent($element, 'id')); + $this->assertEquals($notice->content, ActivityUtils::childContent($element, 'title')); + $this->assertEquals($notice->rendered, ActivityUtils::childContent($element, 'content')); + $this->assertEquals(strtotime($notice->created), strtotime(ActivityUtils::childContent($element, 'published'))); + $this->assertEquals(strtotime($notice->created), strtotime(ActivityUtils::childContent($element, 'updated'))); + $this->assertEquals(ActivityVerb::POST, ActivityUtils::childContent($element, 'verb', Activity::SPEC)); + $this->assertEquals(ActivityObject::NOTE, ActivityUtils::childContent($element, 'object-type', Activity::SPEC)); + } + + public function testNamespaceFlag() + { + $notice = $this->_fakeNotice(); + + $entry = $notice->asAtomEntry(true); + + $element = $this->_entryToElement($entry, false); + + $this->assertTrue($element->hasAttribute('xmlns')); + $this->assertTrue($element->hasAttribute('xmlns:thr')); + $this->assertTrue($element->hasAttribute('xmlns:georss')); + $this->assertTrue($element->hasAttribute('xmlns:activity')); + $this->assertTrue($element->hasAttribute('xmlns:media')); + $this->assertTrue($element->hasAttribute('xmlns:poco')); + $this->assertTrue($element->hasAttribute('xmlns:ostatus')); + $this->assertTrue($element->hasAttribute('xmlns:statusnet')); + + $entry = $notice->asAtomEntry(false); + + $element = $this->_entryToElement($entry, true); + + $this->assertFalse($element->hasAttribute('xmlns')); + $this->assertFalse($element->hasAttribute('xmlns:thr')); + $this->assertFalse($element->hasAttribute('xmlns:georss')); + $this->assertFalse($element->hasAttribute('xmlns:activity')); + $this->assertFalse($element->hasAttribute('xmlns:media')); + $this->assertFalse($element->hasAttribute('xmlns:poco')); + $this->assertFalse($element->hasAttribute('xmlns:ostatus')); + $this->assertFalse($element->hasAttribute('xmlns:statusnet')); + } + + public function testSourceFlag() + { + $notice = $this->_fakeNotice(); + + // Test with no source + + $entry = $notice->asAtomEntry(false, false); + + $element = $this->_entryToElement($entry, true); + + $source = ActivityUtils::child($element, 'source'); + + $this->assertNull($source); + + // Test with source + + $entry = $notice->asAtomEntry(false, true); + + $element = $this->_entryToElement($entry, true); + + $source = ActivityUtils::child($element, 'source'); + + $this->assertNotNull($source); + } + + public function testSourceContent() + { + $notice = $this->_fakeNotice(); + // make a time difference! + sleep(2); + $notice2 = $this->_fakeNotice(); + + $entry = $notice->asAtomEntry(false, true); + + $element = $this->_entryToElement($entry, true); + + $source = ActivityUtils::child($element, 'source'); + + $atomUrl = common_local_url('ApiTimelineUser', array('id' => $this->author1->id, 'format' => 'atom')); + + $profile = $this->author1->getProfile(); + + $this->assertEquals($atomUrl, ActivityUtils::childContent($source, 'id')); + $this->assertEquals($atomUrl, ActivityUtils::getLink($source, 'self', 'application/atom+xml')); + $this->assertEquals($profile->profileurl, ActivityUtils::getPermalink($source)); + $this->assertEquals(strtotime($notice2->created), strtotime(ActivityUtils::childContent($source, 'updated'))); + // XXX: do we care here? + $this->assertFalse(is_null(ActivityUtils::childContent($source, 'title'))); + $this->assertEquals(common_config('license', 'url'), ActivityUtils::getLink($source, 'license')); + } + + public function testAuthorFlag() + { + $notice = $this->_fakeNotice(); + + // Test with no author + + $entry = $notice->asAtomEntry(false, false, false); + + $element = $this->_entryToElement($entry, true); + + $this->assertNull(ActivityUtils::child($element, 'author')); + $this->assertNull(ActivityUtils::child($element, 'actor', Activity::SPEC)); + + // Test with source + + $entry = $notice->asAtomEntry(false, false, true); + + $element = $this->_entryToElement($entry, true); + + $author = ActivityUtils::child($element, 'author'); + $actor = ActivityUtils::child($element, 'actor', Activity::SPEC); + + $this->assertFalse(is_null($author)); + $this->assertFalse(is_null($actor)); + } + + public function testAuthorContent() + { + $notice = $this->_fakeNotice(); + + // Test with author + + $entry = $notice->asAtomEntry(false, false, true); + + $element = $this->_entryToElement($entry, true); + + $author = ActivityUtils::child($element, 'author'); + + $this->assertEquals($this->author1->nickname, ActivityUtils::childContent($author, 'name')); + $this->assertEquals($this->author1->uri, ActivityUtils::childContent($author, 'uri')); + } + + public function testActorContent() + { + $notice = $this->_fakeNotice(); + + // Test with author + + $entry = $notice->asAtomEntry(false, false, true); + + $element = $this->_entryToElement($entry, true); + + $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')); + } + + public function testReplyLink() + { + $orig = $this->_fakeNotice($this->targetUser1); + + $text = "@" . $this->targetUser1->nickname . " reply text " . common_good_rand(4); + + $reply = Notice::saveNew($this->author1->id, $text, 'test', array('uri' => null, 'reply_to' => $orig->id)); + + $entry = $reply->asAtomEntry(); + + $element = $this->_entryToElement($entry, true); + + $irt = ActivityUtils::child($element, 'in-reply-to', 'http://purl.org/syndication/thread/1.0'); + + $this->assertNotNull($irt); + $this->assertEquals($orig->uri, $irt->getAttribute('ref')); + $this->assertEquals($orig->bestUrl(), $irt->getAttribute('href')); + } + + public function testReplyAttention() + { + $orig = $this->_fakeNotice($this->targetUser1); + + $text = "@" . $this->targetUser1->nickname . " reply text " . common_good_rand(4); + + $reply = Notice::saveNew($this->author1->id, $text, 'test', array('uri' => null, 'reply_to' => $orig->id)); + + $entry = $reply->asAtomEntry(); + + $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() + { + $orig = $this->_fakeNotice($this->targetUser1); + + $text = "@" . $this->targetUser1->nickname . " reply text " . common_good_rand(4); + + $reply = Notice::saveNew($this->targetUser2->id, $text, 'test', array('uri' => null, 'reply_to' => $orig->id)); + + $text = "@" . $this->targetUser1->nickname . " @" . $this->targetUser2->nickname . " reply text " . common_good_rand(4); + + $reply2 = Notice::saveNew($this->author1->id, $text, 'test', array('uri' => null, 'reply_to' => $reply->id)); + + $entry = $reply2->asAtomEntry(); + + $element = $this->_entryToElement($entry, true); + + $links = ActivityUtils::getLinks($element, 'ostatus:attention'); + + $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)); + + $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() + { + $text = "!" . $this->targetGroup1->nickname . " reply text " . common_good_rand(4); + + $notice = Notice::saveNew($this->author1->id, $text, 'test', array('uri' => null)); + + $entry = $notice->asAtomEntry(); + + $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() + { + $text = "!" . $this->targetGroup1->nickname . " !" . $this->targetGroup2->nickname . " reply text " . common_good_rand(4); + + $notice = Notice::saveNew($this->author1->id, $text, 'test', array('uri' => null)); + + $entry = $notice->asAtomEntry(); + + $element = $this->_entryToElement($entry, true); + + $links = ActivityUtils::getLinks($element, 'ostatus:attention'); + + $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)); + + $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() + { + $notice = $this->_fakeNotice($this->author1); + $repeat = $notice->repeat($this->author2->id, 'test'); + + $entry = $repeat->asAtomEntry(); + + $element = $this->_entryToElement($entry, true); + + $forward = ActivityUtils::child($element, 'forward', "http://ostatus.org/schema/1.0"); + + $this->assertNotNull($forward); + $this->assertEquals($notice->uri, $forward->getAttribute('ref')); + $this->assertEquals($notice->bestUrl(), $forward->getAttribute('href')); + } + + public function testTag() + { + $tag1 = common_good_rand(4); + + $notice = $this->_fakeNotice($this->author1, '#' . $tag1); + + $entry = $notice->asAtomEntry(); + + $element = $this->_entryToElement($entry, true); + + $category = ActivityUtils::child($element, 'category'); + + $this->assertNotNull($category); + $this->assertEquals($tag1, $category->getAttribute('term')); + } + + public function testMultiTag() + { + $tag1 = common_good_rand(4); + $tag2 = common_good_rand(4); + + $notice = $this->_fakeNotice($this->author1, '#' . $tag1 . ' #' . $tag2); + + $entry = $notice->asAtomEntry(); + + $element = $this->_entryToElement($entry, true); + + $categories = $element->getElementsByTagName('category'); + + $this->assertNotNull($categories); + $this->assertEquals(2, $categories->length); + + $terms = array(); + + for ($i = 0; $i < $categories->length; $i++) { + $cat = $categories->item($i); + $terms[] = $cat->getAttribute('term'); + } + + $this->assertTrue(in_array($tag1, $terms)); + $this->assertTrue(in_array($tag2, $terms)); + } + + public function testGeotaggedActivity() + { + $notice = Notice::saveNew($this->author1->id, common_good_rand(4), 'test', array('uri' => null, 'lat' => 45.5, 'lon' => -73.6)); + + $entry = $notice->asAtomEntry(); + + $element = $this->_entryToElement($entry, true); + + $this->assertEquals('45.5 -73.6', ActivityUtils::childContent($element, 'point', "http://www.georss.org/georss")); + } + + public function testNoticeInfo() + { + $notice = $this->_fakeNotice(); + + $entry = $notice->asAtomEntry(); + + $element = $this->_entryToElement($entry, true); + + $noticeInfo = ActivityUtils::child($element, 'notice_info', "http://status.net/schema/api/1/"); + + $this->assertEquals($notice->id, $noticeInfo->getAttribute('local_id')); + $this->assertEquals($notice->source, $noticeInfo->getAttribute('source')); + $this->assertEquals('', $noticeInfo->getAttribute('repeat_of')); + $this->assertEquals('', $noticeInfo->getAttribute('repeated')); + $this->assertEquals('', $noticeInfo->getAttribute('favorite')); + $this->assertEquals('', $noticeInfo->getAttribute('source_link')); + } + + public function testNoticeInfoRepeatOf() + { + $notice = $this->_fakeNotice(); + + $repeat = $notice->repeat($this->author2->id, 'test'); + + $entry = $repeat->asAtomEntry(); + + $element = $this->_entryToElement($entry, true); + + $noticeInfo = ActivityUtils::child($element, 'notice_info', "http://status.net/schema/api/1/"); + + $this->assertEquals($notice->id, $noticeInfo->getAttribute('repeat_of')); + } + + public function testNoticeInfoRepeated() + { + $notice = $this->_fakeNotice(); + + $repeat = $notice->repeat($this->author2->id, 'test'); + + $entry = $notice->asAtomEntry(false, false, false, $this->author2); + + $element = $this->_entryToElement($entry, true); + + $noticeInfo = ActivityUtils::child($element, 'notice_info', "http://status.net/schema/api/1/"); + + $this->assertEquals('true', $noticeInfo->getAttribute('repeated')); + + $entry = $notice->asAtomEntry(false, false, false, $this->targetUser1); + + $element = $this->_entryToElement($entry, true); + + $noticeInfo = ActivityUtils::child($element, 'notice_info', "http://status.net/schema/api/1/"); + + $this->assertEquals('false', $noticeInfo->getAttribute('repeated')); + } + + public function testNoticeInfoFave() + { + $notice = $this->_fakeNotice(); + + $fave = Fave::addNew($this->author2->getProfile(), $notice); + + // Should be set if user has faved + + $entry = $notice->asAtomEntry(false, false, false, $this->author2); + + $element = $this->_entryToElement($entry, true); + + $noticeInfo = ActivityUtils::child($element, 'notice_info', "http://status.net/schema/api/1/"); + + $this->assertEquals('true', $noticeInfo->getAttribute('favorite')); + + // Shouldn't be set if user has not faved + + $entry = $notice->asAtomEntry(false, false, false, $this->targetUser1); + + $element = $this->_entryToElement($entry, true); + + $noticeInfo = ActivityUtils::child($element, 'notice_info', "http://status.net/schema/api/1/"); + + $this->assertEquals('false', $noticeInfo->getAttribute('favorite')); + } + + public function testConversationLink() + { + $orig = $this->_fakeNotice($this->targetUser1); + + $text = "@" . $this->targetUser1->nickname . " reply text " . common_good_rand(4); + + $reply = Notice::saveNew($this->author1->id, $text, 'test', array('uri' => null, 'reply_to' => $orig->id)); + + $conv = Conversation::staticGet('id', $reply->conversation); + + $entry = $reply->asAtomEntry(); + + $element = $this->_entryToElement($entry, true); + + $this->assertEquals($conv->uri, ActivityUtils::getLink($element, 'ostatus:conversation')); + } + + function __destruct() + { + if (!is_null($this->author1)) { + $this->author1->delete(); + } + + if (!is_null($this->author2)) { + $this->author2->delete(); + } + + if (!is_null($this->targetUser1)) { + $this->targetUser1->delete(); + } + + if (!is_null($this->targetUser2)) { + $this->targetUser2->delete(); + } + + if (!is_null($this->targetGroup1)) { + $this->targetGroup1->delete(); + } + + if (!is_null($this->targetGroup2)) { + $this->targetGroup2->delete(); + } + } + + private function _fakeNotice($user = null, $text = null) + { + if (empty($user)) { + $user = $this->author1; + } + + if (empty($text)) { + $text = "fake-o text-o " . common_good_rand(32); + } + + return Notice::saveNew($user->id, $text, 'test', array('uri' => null)); + } + + private function _entryToElement($entry, $namespace = false) + { + $xml = '<?xml version="1.0" encoding="utf-8"?>'."\n\n"; + $xml .= '<feed'; + if ($namespace) { + $xml .= ' xmlns="http://www.w3.org/2005/Atom"'; + $xml .= ' xmlns:thr="http://purl.org/syndication/thread/1.0"'; + $xml .= ' xmlns:georss="http://www.georss.org/georss"'; + $xml .= ' xmlns:activity="http://activitystrea.ms/spec/1.0/"'; + $xml .= ' xmlns:media="http://purl.org/syndication/atommedia"'; + $xml .= ' xmlns:poco="http://portablecontacts.net/spec/1.0"'; + $xml .= ' xmlns:ostatus="http://ostatus.org/schema/1.0"'; + $xml .= ' xmlns:statusnet="http://status.net/schema/api/1/"'; + } + $xml .= '>' . "\n" . $entry . "\n" . '</feed>' . "\n"; + $doc = DOMDocument::loadXML($xml); + $feed = $doc->documentElement; + $entries = $feed->getElementsByTagName('entry'); + + return $entries->item(0); + } +} diff --git a/tests/ActivityParseTests.php b/tests/ActivityParseTests.php index 9d8fd47af..378478d74 100644 --- a/tests/ActivityParseTests.php +++ b/tests/ActivityParseTests.php @@ -22,14 +22,26 @@ class ActivityParseTests extends PHPUnit_Framework_TestCase $this->assertFalse(empty($act)); - $this->assertEquals($act->time, 1243860840); - $this->assertEquals($act->verb, ActivityVerb::POST); + $this->assertEquals(1243860840, $act->time); + $this->assertEquals(ActivityVerb::POST, $act->verb); - $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'); + $this->assertFalse(empty($act->objects[0])); + $this->assertEquals('Punctuation Changeset', $act->objects[0]->title); + $this->assertEquals('http://versioncentral.example.org/activity/changeset', $act->objects[0]->type); + $this->assertEquals('Fixing punctuation because it makes it more readable.', $act->objects[0]->summary); + $this->assertEquals('tag:versioncentral.example.org,2009:/change/1643245', $act->objects[0]->id); + } + + public function testExample2() + { + global $_example2; + $dom = DOMDocument::loadXML($_example2); + $act = new Activity($dom->documentElement); + + $this->assertFalse(empty($act)); + // Did we handle <content type="html"> correctly with a typical payload? + $this->assertEquals("<p>Geraldine posted a Photo on PhotoPanic</p>\n " . + "<img src=\"/geraldine/photo1.jpg\">", trim($act->content)); } public function testExample3() @@ -46,22 +58,22 @@ class ActivityParseTests extends PHPUnit_Framework_TestCase $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(1071340202, $act->time); + $this->assertEquals('http://example.org/2003/12/13/atom03.html', $act->link); $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->assertEquals(ActivityObject::PERSON, $act->actor->type); + $this->assertEquals('John Doe', $act->actor->title); + $this->assertEquals('mailto:johndoe@example.com', $act->actor->id); - $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->objects[0])); + $this->assertEquals(ActivityObject::NOTE, $act->objects[0]->type); + $this->assertEquals('urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a', $act->objects[0]->id); + $this->assertEquals('Atom-Powered Robots Run Amok', $act->objects[0]->title); + $this->assertEquals('Some text.', $act->objects[0]->summary); + $this->assertEquals('http://example.org/2003/12/13/atom03.html', $act->objects[0]->link); $this->assertFalse(empty($act->context)); @@ -90,8 +102,8 @@ class ActivityParseTests extends PHPUnit_Framework_TestCase $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, + $this->assertFalse(empty($act->objects[0])); + $this->assertEquals($act->objects[0]->content, '@<span class="vcard"><a href="http://example.net/user/1" class="url"><span class="fn nickname">evan</span></a></span> now is the time for all good men to come to the aid of their country. #<span class="tag"><a href="http://example.net/tag/thetime" rel="tag">thetime</a></span>'); $this->assertFalse(empty($act->actor)); @@ -207,7 +219,7 @@ class ActivityParseTests extends PHPUnit_Framework_TestCase $this->assertTrue(is_array($actor->avatarLinks)); $this->assertEquals(1, count($actor->avatarLinks)); $this->assertEquals('http://files.posterous.com/user_profile_pics/480326/2009-08-05-142447.jpg', - $actor->avatarLinks[0]); + $actor->avatarLinks[0]->url); $this->assertNotNull($actor->poco); $this->assertEquals('evanpro', $actor->poco->preferredUsername); $this->assertEquals('Evan Prodromou', $actor->poco->displayName); @@ -215,6 +227,161 @@ class ActivityParseTests extends PHPUnit_Framework_TestCase $this->assertNull($actor->poco->address); $this->assertEquals(0, count($actor->poco->urls)); } + + // Media test - cliqset + public function testExample8() + { + global $_example8; + $dom = DOMDocument::loadXML($_example8); + + $feed = $dom->documentElement; + + $entries = $feed->getElementsByTagName('entry'); + + $entry = $entries->item(0); + + $act = new Activity($entry, $feed); + + $this->assertFalse(empty($act)); + $this->assertEquals($act->time, 1269221753); + $this->assertEquals($act->verb, ActivityVerb::POST); + $this->assertEquals($act->summary, 'zcopley posted 5 photos on Flickr'); + + $this->assertFalse(empty($act->objects)); + $this->assertEquals(sizeof($act->objects), 5); + + $this->assertEquals($act->objects[0]->type, ActivityObject::PHOTO); + $this->assertEquals($act->objects[0]->title, 'IMG_1368'); + $this->assertNull($act->objects[0]->description); + $this->assertEquals( + $act->objects[0]->thumbnail, + 'http://media.cliqset.com/6f6fbee9d7dfbffc73b6ef626275eb5f_thumb.jpg' + ); + $this->assertEquals( + $act->objects[0]->link, + 'http://www.flickr.com/photos/zcopley/4452933806/' + ); + + $this->assertEquals($act->objects[1]->type, ActivityObject::PHOTO); + $this->assertEquals($act->objects[1]->title, 'IMG_1365'); + $this->assertNull($act->objects[1]->description); + $this->assertEquals( + $act->objects[1]->thumbnail, + 'http://media.cliqset.com/b8f3932cd0bba1b27f7c8b3ef986915e_thumb.jpg' + ); + $this->assertEquals( + $act->objects[1]->link, + 'http://www.flickr.com/photos/zcopley/4442630390/' + ); + + $this->assertEquals($act->objects[2]->type, ActivityObject::PHOTO); + $this->assertEquals($act->objects[2]->title, 'Classic'); + $this->assertEquals( + $act->objects[2]->description, + '-Powered by pikchur.com/n0u' + ); + $this->assertEquals( + $act->objects[2]->thumbnail, + 'http://media.cliqset.com/fc54c15f850b7a9a8efa644087a48c91_thumb.jpg' + ); + $this->assertEquals( + $act->objects[2]->link, + 'http://www.flickr.com/photos/zcopley/4430754103/' + ); + + $this->assertEquals($act->objects[3]->type, ActivityObject::PHOTO); + $this->assertEquals($act->objects[3]->title, 'IMG_1363'); + $this->assertNull($act->objects[3]->description); + + $this->assertEquals( + $act->objects[3]->thumbnail, + 'http://media.cliqset.com/4b1d307c9217e2114391a8b229d612cb_thumb.jpg' + ); + $this->assertEquals( + $act->objects[3]->link, + 'http://www.flickr.com/photos/zcopley/4416969717/' + ); + + $this->assertEquals($act->objects[4]->type, ActivityObject::PHOTO); + $this->assertEquals($act->objects[4]->title, 'IMG_1361'); + $this->assertNull($act->objects[4]->description); + + $this->assertEquals( + $act->objects[4]->thumbnail, + 'http://media.cliqset.com/23d9b4b96b286e0347d36052f22f6e60_thumb.jpg' + ); + $this->assertEquals( + $act->objects[4]->link, + 'http://www.flickr.com/photos/zcopley/4417734232/' + ); + + } + + public function testAtomContent() + { + $tests = array(array("<content>Some regular plain text.</content>", + "Some regular plain text."), + array("<content><b>this is not HTML</b></content>", + "<b>this is not HTML</b>"), + array("<content type='html'>Some regular plain HTML.</content>", + "Some regular plain HTML."), + array("<content type='html'><b>this is too HTML</b></content>", + "<b>this is too HTML</b>"), + array("<content type='html'>&lt;b&gt;but this is not HTML!&lt;/b&gt;</content>", + "<b>but this is not HTML!</b>"), + array("<content type='xhtml'><div xmlns='http://www.w3.org/1999/xhtml'>Some regular plain XHTML.</div></content>", + "Some regular plain XHTML."), + array("<content type='xhtml'><div xmlns='http://www.w3.org/1999/xhtml'><b>This is some XHTML!</b></div></content>", + "<b>This is some XHTML!</b>"), + array("<content type='xhtml'><div xmlns='http://www.w3.org/1999/xhtml'><b>This is not some XHTML!</b></div></content>", + "<b>This is not some XHTML!</b>"), + array("<content type='xhtml'><div xmlns='http://www.w3.org/1999/xhtml'>&lt;b&gt;This is not some XHTML either!&lt;/b&gt;</div></content>", + "&lt;b&gt;This is not some XHTML either!&lt;/b&gt;")); + foreach ($tests as $data) { + list($source, $output) = $data; + $xml = "<entry xmlns='http://www.w3.org/2005/Atom'>" . + "<id>http://example.com/fakeid</id>" . + "<author><name>Test</name></author>" . + "<title>Atom content tests</title>" . + $source . + "</entry>"; + $dom = DOMDocument::loadXML($xml); + $act = new Activity($dom->documentElement); + + $this->assertFalse(empty($act)); + $this->assertEquals($output, trim($act->content)); + } + } + + public function testRssContent() + { + $tests = array(array("<content:encoded>Some regular plain HTML.</content:encoded>", + "Some regular plain HTML."), + array("<content:encoded>Some <b>exciting bold HTML</b></content:encoded>", + "Some <b>exciting bold HTML</b>"), + array("<content:encoded>Some &lt;b&gt;escaped non-HTML.&lt;/b&gt;</content:encoded>", + "Some <b>escaped non-HTML.</b>"), + array("<description>Some plain text.</description>", + "Some plain text."), + array("<description>Some <b>non-HTML text</b></description>", + "Some <b>non-HTML text</b>"), + array("<description>Some &lt;b&gt;double-escaped text&lt;/b&gt;</description>", + "Some &lt;b&gt;double-escaped text&lt;/b&gt;")); + foreach ($tests as $data) { + list($source, $output) = $data; + $xml = "<item xmlns:content='http://purl.org/rss/1.0/modules/content/'>" . + "<guid>http://example.com/fakeid</guid>" . + "<title>RSS content tests</title>" . + $source . + "</item>"; + $dom = DOMDocument::loadXML($xml); + $act = new Activity($dom->documentElement); + + $this->assertFalse(empty($act)); + $this->assertEquals($output, trim($act->content)); + } + } + } $_example1 = <<<EXAMPLE1 @@ -508,3 +675,120 @@ $_example7 = <<<EXAMPLE7 </channel> </rss> EXAMPLE7; + +$_example8 = <<<EXAMPLE8 +<?xml version="1.0"?> +<feed xmlns="http://www.w3.org/2005/Atom"> + <link href="http://pubsubhubbub.appspot.com/" rel="hub"/> + <title type="text">Activity Stream for: zcopley</title> + <id>http://cliqset.com/feed/atom?uid=zcopley</id> + <entry xmlns:service="http://activitystrea.ms/service-provider" xmlns:activity="http://activitystrea.ms/spec/1.0/"> + <thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total> + <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb> + <published>2010-03-22T01:35:53.000Z</published> + <service:provider> + <name>flickr</name> + <uri>http://flickr.com</uri> + <icon>http://cliqset-services.s3.amazonaws.com/flickr.png</icon> + </service:provider> + <activity:object> + <activity:object-type>http://activitystrea.ms/schema/1.0/photo</activity:object-type> + <title type="text">IMG_1368</title> + <link type="image/jpeg" rel="preview" href="http://media.cliqset.com/6f6fbee9d7dfbffc73b6ef626275eb5f_thumb.jpg"/> + <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/zcopley/4452933806/"/> + </activity:object> + <activity:object> + <activity:object-type>http://activitystrea.ms/schema/1.0/photo</activity:object-type> + <title type="text">IMG_1365</title> + <link type="image/jpeg" rel="preview" href="http://media.cliqset.com/b8f3932cd0bba1b27f7c8b3ef986915e_thumb.jpg"/> + <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/zcopley/4442630390/"/> + </activity:object> + <activity:object xmlns:media="http://purl.org/syndication/atommedia"> + <activity:object-type>http://activitystrea.ms/schema/1.0/photo</activity:object-type> + <title type="text">Classic</title> + <link type="image/jpeg" rel="preview" href="http://media.cliqset.com/fc54c15f850b7a9a8efa644087a48c91_thumb.jpg"/> + <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/zcopley/4430754103/"/> + <media:description type="text">-Powered by pikchur.com/n0u</media:description> + </activity:object> + <activity:object> + <activity:object-type>http://activitystrea.ms/schema/1.0/photo</activity:object-type> + <title type="text">IMG_1363</title> + <link type="image/jpeg" rel="preview" href="http://media.cliqset.com/4b1d307c9217e2114391a8b229d612cb_thumb.jpg"/> + <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/zcopley/4416969717/"/> + </activity:object> + <activity:object> + <activity:object-type>http://activitystrea.ms/schema/1.0/photo</activity:object-type> + <title type="text">IMG_1361</title> + <link type="image/jpeg" rel="preview" href="http://media.cliqset.com/23d9b4b96b286e0347d36052f22f6e60_thumb.jpg"/> + <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/zcopley/4417734232/"/> + </activity:object> + <title type="text">zcopley posted some photos on Flickr</title> + <summary type="text">zcopley posted 5 photos on Flickr</summary> + <category scheme="http://schemas.cliqset.com/activity/categories/1.0" term="PhotoPosted" label="Photo Posted"/> + <updated>2010-03-22T20:46:42.778Z</updated> + <id>tag:cliqset.com,2010-03-22:/user/zcopley/SVgAZubGhtAnSAee</id> + <link href="http://cliqset.com/user/zcopley/SVgAZubGhtAnSAee" type="text/xhtml" rel="alternate" title="zcopley posted some photos on Flickr"/> + <author> + <name>zcopley</name> + <uri>http://cliqset.com/user/zcopley</uri> + </author> + <activity:actor xmlns:poco="http://portablecontacts.net/spec/1.0"> + <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> + <id>zcopley</id> + <poco:name> + <poco:givenName>Zach</poco:givenName> + <poco:familyName>Copley</poco:familyName> + </poco:name> + <link xmlns:media="http://purl.org/syndication/atommedia" type="image/png" rel="avatar" href="http://dynamic.cliqset.com/avatar/zcopley?s=80" media:height="80" media:width="80"/> + <link xmlns:media="http://purl.org/syndication/atommedia" type="image/png" rel="avatar" href="http://dynamic.cliqset.com/avatar/zcopley?s=120" media:height="120" media:width="120"/> + <link xmlns:media="http://purl.org/syndication/atommedia" type="image/png" rel="avatar" href="http://dynamic.cliqset.com/avatar/zcopley?s=200" media:height="200" media:width="200"/> + </activity:actor> + </entry> +</feed> +EXAMPLE8; + +$_example9 = <<<EXAMPLE9 +<?xml version="1.0" encoding="utf-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:media="http://search.yahoo.com/mrss" xmlns:activity="http://activitystrea.ms/spec/1.0/"> + <link rel="self" type="application/atom+xml" href="http://buzz.googleapis.com/feeds/117848251937215158042/public/posted"/> + <link rel="hub" href="http://pubsubhubbub.appspot.com/"/> + <title type="text">Google Buzz</title> + <updated>2010-03-22T01:55:53.596Z</updated> + <id>tag:google.com,2009:buzz-feed/public/posted/117848251937215158042</id> + <generator>Google - Google Buzz</generator> + <entry> + <title type="html">Buzz by Zach Copley from Flickr</title> + <summary type="text">IMG_1366</summary> + <published>2010-03-18T04:29:23.000Z</published> + <updated>2010-03-18T05:14:03.325Z</updated> + <id>tag:google.com,2009:buzz/z12zwdhxowq2d13q204cjr04kzu0cns5gh0</id> + <link rel="alternate" type="text/html" href="http://www.google.com/buzz/117848251937215158042/ZU7b6mHJEmC/IMG-1366"/> + <author> + <name>Zach Copley</name> + <uri>http://www.google.com/profiles/zcopley</uri> + </author> + <content type="html"><div>IMG_1366</div></content> + <link rel="enclosure" href="http://www.flickr.com/photos/22823034@N00/4442630700" type="image/jpeg" title="IMG_1366"/> + <media:content url="http://www.flickr.com/photos/22823034@N00/4442630700" type="image/jpeg" medium="image"> + <media:title>IMG_1366</media:title> + <media:player url="http://farm5.static.flickr.com/4053/4442630700_980b19a1a6_o.jpg" height="1600" width="1200"/> + </media:content> + <link rel="enclosure" href="http://www.flickr.com/photos/22823034@N00/4442630390" type="image/jpeg" title="IMG_1365"/> + <media:content url="http://www.flickr.com/photos/22823034@N00/4442630390" type="image/jpeg" medium="image"> + <media:title>IMG_1365</media:title> + <media:player url="http://farm5.static.flickr.com/4043/4442630390_62da5560ae_o.jpg" height="1200" width="1600"/> + </media:content> + <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb> + <activity:object> + <activity:object-type>http://activitystrea.ms/schema/1.0/photo</activity:object-type> + <id>tag:google.com,2009:buzz/z12zwdhxowq2d13q204cjr04kzu0cns5gh0</id> + <title>Buzz by Zach Copley from Flickr</title> + <content type="html"><div>IMG_1366</div></content> + <link rel="enclosure" href="http://www.flickr.com/photos/22823034@N00/4442630700" type="image/jpeg" title="IMG_1366"/> + <link rel="enclosure" href="http://www.flickr.com/photos/22823034@N00/4442630390" type="image/jpeg" title="IMG_1365"/> + </activity:object> + <link rel="replies" type="application/atom+xml" href="http://buzz.googleapis.com/feeds/117848251937215158042/comments/z12zwdhxowq2d13q204cjr04kzu0cns5gh0" thr:count="0"/> + <thr:total>0</thr:total> + </entry> +</feed> +EXAMPLE9; diff --git a/tests/JidValidateTest.php b/tests/JidValidateTest.php new file mode 100644 index 000000000..9f5901139 --- /dev/null +++ b/tests/JidValidateTest.php @@ -0,0 +1,146 @@ +<?php + +if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { + print "This script must be run from the command line\n"; + exit(); +} + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); +define('STATUSNET', true); +define('LACONICA', true); + +mb_internal_encoding('UTF-8'); // @fixme this probably belongs in common.php? + +require_once INSTALLDIR . '/lib/common.php'; +require_once INSTALLDIR . '/lib/jabber.php'; + +class JidValidateTest extends PHPUnit_Framework_TestCase +{ + /** + * @dataProvider validationCases + * + */ + public function testValidate($jid, $validFull, $validBase) + { + $this->assertEquals($validFull, jabber_valid_full_jid($jid), "validating as full or base JID"); + + $this->assertEquals($validBase, jabber_valid_base_jid($jid), "validating as base JID only"); + } + + /** + * @dataProvider normalizationCases + * + */ + public function testNormalize($jid, $expected) + { + $this->assertEquals($expected, jabber_normalize_jid($jid)); + } + + /** + * @dataProvider domainCheckCases() + */ + public function testDomainCheck($domain, $expected, $note) + { + $this->assertEquals($expected, jabber_check_domain($domain), $note); + } + + static public function validationCases() + { + $long1023 = "long1023" . str_repeat('x', 1023 - 8); + $long1024 = "long1024" . str_repeat('x', 1024 - 8); + return array( + // Our own test cases for standard things & those mentioned in bug reports + // (jid, valid_full, valid_base) + array('user@example.com', true, true), + array('user@example.com/resource', true, false), + array('user with spaces@example.com', false, false), // not kosher + + array('user.@example.com', true, true), // "common in intranets" + array('example.com', true, true), + array('example.com/resource', true, false), + array('jabchat', true, true), + + array("$long1023@$long1023/$long1023", true, false), // max 1023 "bytes" per portion per spec. Do they really mean bytes though? + array("$long1024@$long1023/$long1023", false, false), + array("$long1023@$long1024/$long1023", false, false), + array("$long1023@$long1023/$long1024", false, false), + + // Borrowed from test_jabber_jutil.c in libpurple + array("gmail.com", true, true), + array("gmail.com/Test", true, false), + array("gmail.com/Test@", true, false), + array("gmail.com/@", true, false), + array("gmail.com/Test@alkjaweflkj", true, false), + array("mark.doliner@gmail.com", true, true), + array("mark.doliner@gmail.com/Test12345", true, false), + array("mark.doliner@gmail.com/Test@12345", true, false), + array("mark.doliner@gmail.com/Te/st@12@//345", true, false), + array("わいど@conference.jabber.org", true, true), + array("まりるーむ@conference.jabber.org", true, true), + array("mark.doliner@gmail.com/まりるーむ", true, false), + array("mark.doliner@gmail/stuff.org", true, false), + array("stuart@nödåtXäYZ.se", true, true), + array("stuart@nödåtXäYZ.se/まりるーむ", true, false), + array("mark.doliner@わいど.org", true, true), + array("nick@まつ.おおかみ.net", true, true), + array("paul@10.0.42.230/s", true, false), + array("paul@[::1]", true, true), /* IPv6 */ + array("paul@[2001:470:1f05:d58::2]", true, true), + array("paul@[2001:470:1f05:d58::2]/foo", true, false), + array("pa=ul@10.0.42.230", true, true), + array("pa,ul@10.0.42.230", true, true), + + array("@gmail.com", false, false), + array("@@gmail.com", false, false), + array("mark.doliner@@gmail.com/Test12345", false, false), + array("mark@doliner@gmail.com/Test12345", false, false), + array("@gmail.com/Test@12345", false, false), + array("/Test@12345", false, false), + array("mark.doliner@", false, false), + array("mark.doliner/", false, false), + array("mark.doliner@gmail_stuff.org", false, false), + array("mark.doliner@gmail[stuff.org", false, false), + array("mark.doliner@gmail\\stuff.org", false, false), + array("paul@[::1]124", false, false), + array("paul@2[::1]124/as", false, false), + array("paul@まつ.おおかみ/\x01", false, false), + + /* + * RFC 3454 Section 6 reads, in part, + * "If a string contains any RandALCat character, the + * string MUST NOT contain any LCat character." + * The character is U+066D (ARABIC FIVE POINTED STAR). + */ + // Leaving this one commented out for the moment + // as it shouldn't hurt anything for our purposes. + //array("foo@example.com/٭simplexe٭", false, false) + ); + } + + static public function normalizationCases() + { + return array( + // Borrowed from test_jabber_jutil.c in libpurple + array('PaUL@DaRkRain42.org', 'paul@darkrain42.org'), + array('PaUL@DaRkRain42.org/', 'paul@darkrain42.org'), + array('PaUL@DaRkRain42.org/resource', 'paul@darkrain42.org'), + + // Also adapted from libpurple tests... + array('Ф@darkrain42.org', 'ф@darkrain42.org'), + array('paul@Өarkrain.org', 'paul@өarkrain.org'), + ); + } + + static public function domainCheckCases() + { + return array( + array('gmail.com', true, 'known SRV record'), + array('jabber.org', true, 'known SRV record'), + array('status.net', true, 'known SRV record'), + array('status.leuksman.com', true, 'known no SRV record but valid domain'), + ); + } + + +} + diff --git a/tests/MediaFileTest.php b/tests/MediaFileTest.php new file mode 100644 index 000000000..a76a4f45e --- /dev/null +++ b/tests/MediaFileTest.php @@ -0,0 +1,96 @@ +<?php + +if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { + print "This script must be run from the command line\n"; + exit(); +} + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); +define('STATUSNET', true); +define('LACONICA', true); + +require_once INSTALLDIR . '/lib/common.php'; + +class MediaFileTest extends PHPUnit_Framework_TestCase +{ + + public function setup() + { + $this->old_attachments_supported = common_config('attachments', 'supported'); + $GLOBALS['config']['attachments']['supported'] = true; + } + + public function tearDown() + { + $GLOBALS['config']['attachments']['supported'] = $this->old_attachments_supported; + } + + /** + * @dataProvider fileTypeCases + * + */ + public function testFileType($filename, $expectedType) + { + if (!file_exists($filename)) { + throw new Exception("WTF? $filename test file missing"); + } + + $type = MediaFile::getUploadedFileType($filename, basename($filename)); + $this->assertEquals($expectedType, $type); + } + + /** + * @dataProvider fileTypeCases + * + */ + public function testUploadedFileType($filename, $expectedType) + { + if (!file_exists($filename)) { + throw new Exception("WTF? $filename test file missing"); + } + $tmp = tmpfile(); + fwrite($tmp, file_get_contents($filename)); + + $type = MediaFile::getUploadedFileType($tmp, basename($filename)); + $this->assertEquals($expectedType, $type); + } + + static public function fileTypeCases() + { + $base = dirname(__FILE__); + $dir = "$base/sample-uploads"; + $files = array( + "image.png" => "image/png", + "image.gif" => "image/gif", + "image.jpg" => "image/jpeg", + "image.jpeg" => "image/jpeg", + + "office.pdf" => "application/pdf", + + "wordproc.odt" => "application/vnd.oasis.opendocument.text", + "wordproc.ott" => "application/vnd.oasis.opendocument.text-template", + "wordproc.doc" => "application/msword", + "wordproc.docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "wordproc.rtf" => "text/rtf", + + "spreadsheet.ods" => "application/vnd.oasis.opendocument.spreadsheet", + "spreadsheet.ots" => "application/vnd.oasis.opendocument.spreadsheet-template", + "spreadsheet.xls" => "application/vnd.ms-excel", + "spreadsheet.xlt" => "application/vnd.ms-excel", + "spreadsheet.xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + + "presentation.odp" => "application/vnd.oasis.opendocument.presentation", + "presentation.otp" => "application/vnd.oasis.opendocument.presentation-template", + "presentation.ppt" => "application/vnd.ms-powerpoint", + "presentation.pptx" => "application/vnd.openxmlformats-officedocument.presentationml.presentation", + ); + + $dataset = array(); + foreach ($files as $file => $type) { + $dataset[] = array("$dir/$file", $type); + } + return $dataset; + } + +} + diff --git a/tests/UserFeedParseTest.php b/tests/UserFeedParseTest.php index b3f9a6417..208e71be6 100644 --- a/tests/UserFeedParseTest.php +++ b/tests/UserFeedParseTest.php @@ -66,11 +66,11 @@ class UserFeedParseTests extends PHPUnit_Framework_TestCase // 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->objects[0]->type, 'http://activitystrea.ms/schema/1.0/note'); + $this->assertEquals($act1->objects[0]->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'); + $this->assertEquals($act1->objects[0]->content, 'And now for something completely insane...'); + $this->assertEquals($act1->objects[0]->id, 'http://localhost/statusnet/notice/3'); } diff --git a/tests/sample-uploads/image.gif b/tests/sample-uploads/image.gif Binary files differnew file mode 100644 index 000000000..b636f4b8d --- /dev/null +++ b/tests/sample-uploads/image.gif diff --git a/tests/sample-uploads/image.jpeg b/tests/sample-uploads/image.jpeg Binary files differnew file mode 100644 index 000000000..21fcb5aef --- /dev/null +++ b/tests/sample-uploads/image.jpeg diff --git a/tests/sample-uploads/image.jpg b/tests/sample-uploads/image.jpg Binary files differnew file mode 100644 index 000000000..21fcb5aef --- /dev/null +++ b/tests/sample-uploads/image.jpg diff --git a/tests/sample-uploads/image.png b/tests/sample-uploads/image.png Binary files differnew file mode 100644 index 000000000..60cbcfd17 --- /dev/null +++ b/tests/sample-uploads/image.png diff --git a/tests/sample-uploads/office.pdf b/tests/sample-uploads/office.pdf Binary files differnew file mode 100644 index 000000000..670bc2343 --- /dev/null +++ b/tests/sample-uploads/office.pdf diff --git a/tests/sample-uploads/presentation.odp b/tests/sample-uploads/presentation.odp Binary files differnew file mode 100644 index 000000000..8dd3a428b --- /dev/null +++ b/tests/sample-uploads/presentation.odp diff --git a/tests/sample-uploads/presentation.otp b/tests/sample-uploads/presentation.otp Binary files differnew file mode 100644 index 000000000..1927ee79d --- /dev/null +++ b/tests/sample-uploads/presentation.otp diff --git a/tests/sample-uploads/presentation.pot b/tests/sample-uploads/presentation.pot Binary files differnew file mode 100644 index 000000000..f5124ffa2 --- /dev/null +++ b/tests/sample-uploads/presentation.pot diff --git a/tests/sample-uploads/presentation.potm b/tests/sample-uploads/presentation.potm Binary files differnew file mode 100644 index 000000000..ade1bcb10 --- /dev/null +++ b/tests/sample-uploads/presentation.potm diff --git a/tests/sample-uploads/presentation.ppt b/tests/sample-uploads/presentation.ppt Binary files differnew file mode 100644 index 000000000..f5124ffa2 --- /dev/null +++ b/tests/sample-uploads/presentation.ppt diff --git a/tests/sample-uploads/presentation.pptx b/tests/sample-uploads/presentation.pptx Binary files differnew file mode 100644 index 000000000..21ea61a15 --- /dev/null +++ b/tests/sample-uploads/presentation.pptx diff --git a/tests/sample-uploads/spreadsheet.ods b/tests/sample-uploads/spreadsheet.ods Binary files differnew file mode 100644 index 000000000..7b43e7507 --- /dev/null +++ b/tests/sample-uploads/spreadsheet.ods diff --git a/tests/sample-uploads/spreadsheet.ots b/tests/sample-uploads/spreadsheet.ots Binary files differnew file mode 100644 index 000000000..5f830e6de --- /dev/null +++ b/tests/sample-uploads/spreadsheet.ots diff --git a/tests/sample-uploads/spreadsheet.xls b/tests/sample-uploads/spreadsheet.xls Binary files differnew file mode 100644 index 000000000..2d470e687 --- /dev/null +++ b/tests/sample-uploads/spreadsheet.xls diff --git a/tests/sample-uploads/spreadsheet.xlsx b/tests/sample-uploads/spreadsheet.xlsx Binary files differnew file mode 100644 index 000000000..b97a551f8 --- /dev/null +++ b/tests/sample-uploads/spreadsheet.xlsx diff --git a/tests/sample-uploads/spreadsheet.xlt b/tests/sample-uploads/spreadsheet.xlt Binary files differnew file mode 100644 index 000000000..980423b20 --- /dev/null +++ b/tests/sample-uploads/spreadsheet.xlt diff --git a/tests/sample-uploads/wordproc.doc b/tests/sample-uploads/wordproc.doc Binary files differnew file mode 100644 index 000000000..81c5e34c6 --- /dev/null +++ b/tests/sample-uploads/wordproc.doc diff --git a/tests/sample-uploads/wordproc.docx b/tests/sample-uploads/wordproc.docx Binary files differnew file mode 100644 index 000000000..04ea3c3ec --- /dev/null +++ b/tests/sample-uploads/wordproc.docx diff --git a/tests/sample-uploads/wordproc.odt b/tests/sample-uploads/wordproc.odt Binary files differnew file mode 100644 index 000000000..fa6fe5e9f --- /dev/null +++ b/tests/sample-uploads/wordproc.odt diff --git a/tests/sample-uploads/wordproc.ott b/tests/sample-uploads/wordproc.ott Binary files differnew file mode 100644 index 000000000..99ca8c068 --- /dev/null +++ b/tests/sample-uploads/wordproc.ott diff --git a/tests/sample-uploads/wordproc.rtf b/tests/sample-uploads/wordproc.rtf new file mode 100644 index 000000000..aad2c4605 --- /dev/null +++ b/tests/sample-uploads/wordproc.rtf @@ -0,0 +1,16 @@ +{\rtf1\ansi\deff0\adeflang1025 +{\fonttbl{\f0\froman\fprq2\fcharset128 Times New Roman;}{\f1\froman\fprq2\fcharset128 Times New Roman;}{\f2\fswiss\fprq2\fcharset128 Arial;}{\f3\fnil\fprq2\fcharset128 DejaVu Sans;}} +{\colortbl;\red0\green0\blue0;\red128\green128\blue128;} +{\stylesheet{\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs24\lang1081\ltrch\dbch\af3\langfe2052\hich\f0\fs24\lang1033\loch\f0\fs24\lang1033\snext1 Normal;} +{\s2\sb240\sa120\keepn\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\afs28\lang1081\ltrch\dbch\langfe2052\hich\f2\fs28\lang1033\loch\f2\fs28\lang1033\sbasedon1\snext3 Heading;} +{\s3\sa120\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs24\lang1081\ltrch\dbch\af3\langfe2052\hich\f0\fs24\lang1033\loch\f0\fs24\lang1033\sbasedon1\snext3 Body Text;} +{\s4\sa120\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs24\lang1081\ltrch\dbch\af3\langfe2052\hich\f0\fs24\lang1033\loch\f0\fs24\lang1033\sbasedon3\snext4 List;} +{\s5\sb120\sa120\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs24\lang1081\ai\ltrch\dbch\af3\langfe2052\hich\f0\fs24\lang1033\i\loch\f0\fs24\lang1033\i\sbasedon1\snext5 caption;} +{\s6\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs24\lang1081\ltrch\dbch\af3\langfe2052\hich\f0\fs24\lang1033\loch\f0\fs24\lang1033\sbasedon1\snext6 Index;} +} +{\info{\author Brion }{\creatim\yr2010\mo5\dy10\hr15\min2}{\revtim\yr0\mo0\dy0\hr0\min0}{\printim\yr0\mo0\dy0\hr0\min0}{\comment StarWriter}{\vern3200}}\deftab709 +{\*\pgdsctbl +{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Standard;}} +\paperh15840\paperw12240\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc +\pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs24\lang1081\ltrch\dbch\af3\langfe2052\hich\f0\fs24\lang1033\loch\f0\fs24\lang1033 +\par }
\ No newline at end of file |