2 use Shaarli\Config\ConfigManager
;
4 require_once 'plugins/pubsubhubbub/pubsubhubbub.php';
5 require_once 'application/Router.php';
8 * Class PluginPubsubhubbubTest
9 * Unit test for the pubsubhubbub plugin
11 class PluginPubsubhubbubTest
extends PHPUnit_Framework_TestCase
14 * @var string Config file path (without extension).
16 protected static $configFile = 'tests/utils/config/configJson';
21 public function setUp()
23 PluginManager
::$PLUGINS_PATH = 'plugins';
27 * Test render_feed hook with an RSS feed.
29 public function testPubSubRssRenderFeed()
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;
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]);
42 * Test render_feed hook with an ATOM feed.
44 public function testPubSubAtomRenderFeed()
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;
51 $data = hook_pubsubhubbub_render_feed($data, $conf);
52 $expected = '<link rel="hub" href="'. $hub .'" />';
53 $this->assertEquals($expected, $data['feed_plugins_header'][0]);