4 * PluginReadityourselfTest.php.php
7 // FIXME! add an init method.
8 $conf = new ConfigManager('');
9 require_once 'plugins/readityourself/readityourself.php';
12 * Class PluginWallabagTest
13 * Unit test for the Wallabag plugin
15 class PluginReadityourselfTest
extends PHPUnit_Framework_TestCase
22 PluginManager
::$PLUGINS_PATH = 'plugins';
26 * Test render_linklist hook.
28 function testReadityourselfLinklist()
30 $conf = new ConfigManager('');
31 $conf->set('plugins.READITYOUSELF_URL', 'value');
32 $str = 'http://randomstr.com/test';
42 $data = hook_readityourself_render_linklist($data, $conf);
43 $link = $data['links'][0];
44 // data shouldn't be altered
45 $this->assertEquals($str, $data['title']);
46 $this->assertEquals($str, $link['url']);
49 $this->assertEquals(1, count($link['link_plugin']));
50 $this->assertNotFalse(strpos($link['link_plugin'][0], $str));
54 * Test without config: nothing should happened.
56 function testReadityourselfLinklistWithoutConfig()
58 $conf = new ConfigManager('');
59 $conf->set('plugins.READITYOUSELF_URL', null);
60 $str = 'http://randomstr.com/test';
70 $data = hook_readityourself_render_linklist($data, $conf);
71 $link = $data['links'][0];
72 // data shouldn't be altered
73 $this->assertEquals($str, $data['title']);
74 $this->assertEquals($str, $link['url']);
77 $this->assertArrayNotHasKey('link_plugin', $link);