diff options
author | Brion Vibber <brion@pobox.com> | 2010-02-08 11:06:03 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-02-08 11:15:29 -0800 |
commit | dc09453a77f33c4dfdff306321ce93cf5fbd2d57 (patch) | |
tree | df3ff3713cf36a84efeb09b5650dd49399edc8f4 /plugins/FeedSub/tests/FeedDiscoveryTest.php | |
parent | 5fdcd88176010a72b6a157170784a8aad7bf4131 (diff) |
First steps on converting FeedSub into the pub/sub basis for OStatus communications:
* renamed FeedSub plugin to OStatus
* now setting avatar on subscriptions
* general fixes for subscription
* integrated PuSH hub to handle only user timelines on canonical ID url; sends updates directly
* set $config['feedsub']['nohub'] = true to test w/ foreign feeds that don't have hubs (won't actually receive updates though)
* a few bits of code documentation
* HMAC support for verified distributions (safest if sub setup is on HTTPS)
And a couple core changes:
* minimizing HTML output for exceptions in API requests to aid in debugging
* fix for rel=self link in apitimelineuser when id given
This does not not yet include any of the individual subscription management (Salmon notifications for sub/unsub, etc) nor a nice UI for user subscriptions.
Needs some further cleanup to treat posts as status updates instead of link references.
Diffstat (limited to 'plugins/FeedSub/tests/FeedDiscoveryTest.php')
-rw-r--r-- | plugins/FeedSub/tests/FeedDiscoveryTest.php | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/plugins/FeedSub/tests/FeedDiscoveryTest.php b/plugins/FeedSub/tests/FeedDiscoveryTest.php deleted file mode 100644 index 1c5249701..000000000 --- a/plugins/FeedSub/tests/FeedDiscoveryTest.php +++ /dev/null @@ -1,111 +0,0 @@ -<?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'; -require_once INSTALLDIR . '/plugins/FeedSub/feedsub.php'; - -class FeedDiscoveryTest extends PHPUnit_Framework_TestCase -{ - /** - * @dataProvider provider - * - */ - public function testProduction($url, $html, $expected) - { - $sub = new FeedDiscovery(); - $url = $sub->discoverFromHTML($url, $html); - $this->assertEquals($expected, $url); - } - - static public function provider() - { - $sampleHeader = <<<END -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - -<head profile="http://gmpg.org/xfn/11"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - -<title>leŭksman </title> - -<meta name="generator" content="WordPress 2.8.6" /> <!-- leave this for stats --> - -<link rel="stylesheet" href="http://leuksman.com/log/wp-content/themes/leuksman/style.css" type="text/css" media="screen" /> -<link rel="alternate" type="application/rss+xml" title="leŭksman RSS Feed" href="http://leuksman.com/log/feed/" /> -<link rel="pingback" href="http://leuksman.com/log/xmlrpc.php" /> - -<meta name="viewport" content="width = 640" /> - -<xmeta name="viewport" content="initial-scale=2.3, user-scalable=no" /> - -<style type="text/css" media="screen"> - - #page { background: url("http://leuksman.com/log/wp-content/themes/leuksman/images/kubrickbg.jpg") repeat-y top; border: none; } - -</style> - -<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://leuksman.com/log/xmlrpc.php?rsd" /> -<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://leuksman.com/log/wp-includes/wlwmanifest.xml" /> -<link rel='index' title='leŭksman' href='http://leuksman.com/log' /> -<meta name="generator" content="WordPress 2.8.6" /> -</head> -<body> -</body> -</html> -END; - return array( - array('http://example.com/', - '<html><link rel="alternate" href="http://example.com/feed/rss" type="application/rss+xml">', - 'http://example.com/feed/rss'), - array('http://example.com/atom', - '<html><link rel="alternate" href="http://example.com/feed/atom" type="application/atom+xml">', - 'http://example.com/feed/atom'), - array('http://example.com/empty', - '<html><link rel="alternate" href="http://example.com/index.pdf" type="application/pdf">', - false), - array('http://example.com/tagsoup', - '<body><pre><LINK rel=alternate hRef=http://example.com/feed/rss type=application/rss+xml><fnork', - 'http://example.com/feed/rss'), - // 'rel' attribute must be lowercase, alone per http://www.rssboard.org/rss-autodiscovery - array('http://example.com/tagsoup2', - '<body><pre><LINK rel=" feeders alternate 467" hRef=http://example.com/feed/rss type=application/rss+xml><fnork', - false), - array('http://example.com/tagsoup3', - '<body><pre><LINK rel=ALTERNATE hRef=http://example.com/feed/rss type=application/rss+xml><fnork', - false), - array('http://example.com/relative/link1', - '<html><link rel="alternate" href="/feed/rss" type="application/rss+xml">', - 'http://example.com/feed/rss'), - array('http://example.com/relative/link2', - '<html><link rel="alternate" href="../feed/rss" type="application/rss+xml">', - 'http://example.com/feed/rss'), - array('http://example.com/relative/link3', - '<html><link rel="alternate" href="http:/feed/rss" type="application/rss+xml">', - 'http://example.com/feed/rss'), - array('http://example.com/base/link1', - '<html><link rel="alternate" href="/feed/rss" type="application/rss+xml"><base href="http://target.example.com/">', - 'http://target.example.com/feed/rss'), - array('http://example.com/base/link2', - '<html><link rel="alternate" href="feed/rss" type="application/rss+xml"><base href="http://target.example.com/">', - 'http://target.example.com/feed/rss'), - array('http://example.com/base/link3', - '<html><link rel="alternate" href="http:/feed/rss" type="application/rss+xml"><base href="http://target.example.com/">', - 'http://target.example.com/feed/rss'), - // Trick question! There's a <base> but no href on it - array('http://example.com/relative/fauxbase', - '<html><link rel="alternate" href="../feed/rss" type="application/rss+xml"><base target="top">', - 'http://example.com/feed/rss'), - // Actual WordPress blog header example - array('http://leuksman.com/log/', - $sampleHeader, - 'http://leuksman.com/log/feed/')); - } -} |