From db90dfcbbc406b50381f17a72f24095fee91bb09 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 2 Aug 2016 11:55:49 +0200 Subject: Move PubSubHubbub code as a default plugin --- tests/FeedBuilderTest.php | 14 --------- tests/plugins/PluginPubsubhubbubTest.php | 54 ++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 tests/plugins/PluginPubsubhubbubTest.php (limited to 'tests') diff --git a/tests/FeedBuilderTest.php b/tests/FeedBuilderTest.php index 06a44506..a590306d 100644 --- a/tests/FeedBuilderTest.php +++ b/tests/FeedBuilderTest.php @@ -75,7 +75,6 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase $data = $feedBuilder->buildData(); // Test headers (RSS) $this->assertEquals(self::$RSS_LANGUAGE, $data['language']); - $this->assertEmpty($data['pubsubhub_url']); $this->assertRegExp('/Wed, 03 Aug 2016 09:30:33 \+\d{4}/', $data['last_update']); $this->assertEquals(true, $data['show_dates']); $this->assertEquals('http://host.tld/index.php?do=feed', $data['self_link']); @@ -210,19 +209,6 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase $this->assertTrue($data['show_dates']); } - /** - * Test buildData with hide dates settings. - */ - public function testBuildDataPubsubhub() - { - $feedBuilder = new FeedBuilder(self::$linkDB, FeedBuilder::$FEED_ATOM, self::$serverInfo, null, false); - $feedBuilder->setLocale(self::$LOCALE); - $feedBuilder->setPubsubhubUrl('http://pubsubhub.io'); - $data = $feedBuilder->buildData(); - $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); - $this->assertEquals('http://pubsubhub.io', $data['pubsubhub_url']); - } - /** * Test buildData when Shaarli is served from a subdirectory */ diff --git a/tests/plugins/PluginPubsubhubbubTest.php b/tests/plugins/PluginPubsubhubbubTest.php new file mode 100644 index 00000000..24dd7a11 --- /dev/null +++ b/tests/plugins/PluginPubsubhubbubTest.php @@ -0,0 +1,54 @@ +set('plugins.PUBSUBHUB_URL', $hub); + $data['_PAGE_'] = Router::$PAGE_FEED_RSS; + + $data = hook_pubsubhubbub_render_feed($data, $conf); + $expected = ''; + $this->assertEquals($expected, $data['feed_plugins_header'][0]); + } + + /** + * Test render_feed hook with an ATOM feed. + */ + function testPubSubAtomRenderFeed() + { + $hub = 'http://domain.hub'; + $conf = new ConfigManager(self::$configFile); + $conf->set('plugins.PUBSUBHUB_URL', $hub); + $data['_PAGE_'] = Router::$PAGE_FEED_ATOM; + + $data = hook_pubsubhubbub_render_feed($data, $conf); + $expected = ''; + $this->assertEquals($expected, $data['feed_plugins_header'][0]); + } +} -- cgit v1.2.3