aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/plugins/PluginPubsubhubbubTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/plugins/PluginPubsubhubbubTest.php')
-rw-r--r--tests/plugins/PluginPubsubhubbubTest.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/plugins/PluginPubsubhubbubTest.php b/tests/plugins/PluginPubsubhubbubTest.php
new file mode 100644
index 00000000..69d00936
--- /dev/null
+++ b/tests/plugins/PluginPubsubhubbubTest.php
@@ -0,0 +1,55 @@
1<?php
2use Shaarli\Config\ConfigManager;
3
4require_once 'plugins/pubsubhubbub/pubsubhubbub.php';
5require_once 'application/Router.php';
6
7/**
8 * Class PluginPubsubhubbubTest
9 * Unit test for the pubsubhubbub plugin
10 */
11class PluginPubsubhubbubTest extends PHPUnit_Framework_TestCase
12{
13 /**
14 * @var string Config file path (without extension).
15 */
16 protected static $configFile = 'tests/utils/config/configJson';
17
18 /**
19 * Reset plugin path
20 */
21 public function setUp()
22 {
23 PluginManager::$PLUGINS_PATH = 'plugins';
24 }
25
26 /**
27 * Test render_feed hook with an RSS feed.
28 */
29 public function testPubSubRssRenderFeed()
30 {
31 $hub = 'http://domain.hub';
32 $conf = new ConfigManager(self::$configFile);
33 $conf->set('plugins.PUBSUBHUB_URL', $hub);
34 $data['_PAGE_'] = Router::$PAGE_FEED_RSS;
35
36 $data = hook_pubsubhubbub_render_feed($data, $conf);
37 $expected = '<atom:link rel="hub" href="'. $hub .'" />';
38 $this->assertEquals($expected, $data['feed_plugins_header'][0]);
39 }
40
41 /**
42 * Test render_feed hook with an ATOM feed.
43 */
44 public function testPubSubAtomRenderFeed()
45 {
46 $hub = 'http://domain.hub';
47 $conf = new ConfigManager(self::$configFile);
48 $conf->set('plugins.PUBSUBHUB_URL', $hub);
49 $data['_PAGE_'] = Router::$PAGE_FEED_ATOM;
50
51 $data = hook_pubsubhubbub_render_feed($data, $conf);
52 $expected = '<link rel="hub" href="'. $hub .'" />';
53 $this->assertEquals($expected, $data['feed_plugins_header'][0]);
54 }
55}