diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-08-02 11:55:49 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-12-20 11:41:24 +0100 |
commit | db90dfcbbc406b50381f17a72f24095fee91bb09 (patch) | |
tree | ebe39650f12a80c09f8fae1b87a9d5c4c4141466 /tests/plugins | |
parent | 085efc33cc0cadaed0c01d926604e219e1d44365 (diff) | |
download | Shaarli-db90dfcbbc406b50381f17a72f24095fee91bb09.tar.gz Shaarli-db90dfcbbc406b50381f17a72f24095fee91bb09.tar.zst Shaarli-db90dfcbbc406b50381f17a72f24095fee91bb09.zip |
Move PubSubHubbub code as a default plugin
Diffstat (limited to 'tests/plugins')
-rw-r--r-- | tests/plugins/PluginPubsubhubbubTest.php | 54 |
1 files changed, 54 insertions, 0 deletions
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 @@ | |||
1 | <?php | ||
2 | |||
3 | require_once 'plugins/pubsubhubbub/pubsubhubbub.php'; | ||
4 | require_once 'application/Router.php'; | ||
5 | |||
6 | /** | ||
7 | * Class PluginPubsubhubbubTest | ||
8 | * Unit test for the pubsubhubbub plugin | ||
9 | */ | ||
10 | class PluginPubsubhubbubTest extends PHPUnit_Framework_TestCase | ||
11 | { | ||
12 | /** | ||
13 | * @var string Config file path (without extension). | ||
14 | */ | ||
15 | protected static $configFile = 'tests/utils/config/configJson'; | ||
16 | |||
17 | /** | ||
18 | * Reset plugin path | ||
19 | */ | ||
20 | function setUp() | ||
21 | { | ||
22 | PluginManager::$PLUGINS_PATH = 'plugins'; | ||
23 | } | ||
24 | |||
25 | /** | ||
26 | * Test render_feed hook with an RSS feed. | ||
27 | */ | ||
28 | function testPubSubRssRenderFeed() | ||
29 | { | ||
30 | $hub = 'http://domain.hub'; | ||
31 | $conf = new ConfigManager(self::$configFile); | ||
32 | $conf->set('plugins.PUBSUBHUB_URL', $hub); | ||
33 | $data['_PAGE_'] = Router::$PAGE_FEED_RSS; | ||
34 | |||
35 | $data = hook_pubsubhubbub_render_feed($data, $conf); | ||
36 | $expected = '<atom:link rel="hub" href="'. $hub .'" />'; | ||
37 | $this->assertEquals($expected, $data['feed_plugins_header'][0]); | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | * Test render_feed hook with an ATOM feed. | ||
42 | */ | ||
43 | function testPubSubAtomRenderFeed() | ||
44 | { | ||
45 | $hub = 'http://domain.hub'; | ||
46 | $conf = new ConfigManager(self::$configFile); | ||
47 | $conf->set('plugins.PUBSUBHUB_URL', $hub); | ||
48 | $data['_PAGE_'] = Router::$PAGE_FEED_ATOM; | ||
49 | |||
50 | $data = hook_pubsubhubbub_render_feed($data, $conf); | ||
51 | $expected = '<link rel="hub" href="'. $hub .'" />'; | ||
52 | $this->assertEquals($expected, $data['feed_plugins_header'][0]); | ||
53 | } | ||
54 | } | ||