aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/plugins/PluginPubsubhubbubTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2018-07-28 11:07:55 +0200
committerArthurHoaro <arthur@hoa.ro>2018-07-28 11:07:55 +0200
commit83faedadff76c5bdca036f39f13943f63b27e164 (patch)
tree6f44cede16ec6a60f10b9699e211e0818f06d2c8 /tests/plugins/PluginPubsubhubbubTest.php
parent1d9eb22a3df85b67fe6652c0876cd7382c2fb525 (diff)
parent658988f3aeba7a5a938783249ccf2765251e5597 (diff)
downloadShaarli-83faedadff76c5bdca036f39f13943f63b27e164.tar.gz
Shaarli-83faedadff76c5bdca036f39f13943f63b27e164.tar.zst
Shaarli-83faedadff76c5bdca036f39f13943f63b27e164.zip
Merge tag 'v0.9.7' into stable
Release v0.9.7
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}