3 require_once 'plugins/isso/isso.php';
8 * Test the Isso plugin (comment system).
10 class PluginIssoTest
extends PHPUnit_Framework_TestCase
17 PluginManager
::$PLUGINS_PATH = 'plugins';
21 * Test Isso init without errors.
23 function testWallabagInitNoError()
25 $conf = new ConfigManager('');
26 $conf->set('plugins.ISSO_SERVER', 'value');
27 $errors = isso_init($conf);
28 $this->assertEmpty($errors);
32 * Test Isso init with errors.
34 function testWallabagInitError()
36 $conf = new ConfigManager('');
37 $errors = isso_init($conf);
38 $this->assertNotEmpty($errors);
42 * Test render_linklist hook with valid settings to display the comment form.
44 function testIssoDisplayed()
46 $conf = new ConfigManager('');
47 $conf->set('plugins.ISSO_SERVER', 'value');
49 $str = 'http://randomstr.com/test';
60 $data = hook_isso_render_linklist($data, $conf);
62 // data shouldn't be altered
63 $this->assertEquals($str, $data['title']);
64 $this->assertEquals($str, $data['links'][0]['url']);
67 $this->assertEquals(1, count($data['plugin_end_zone']));
68 $this->assertNotFalse(strpos($data['plugin_end_zone'][0], 'abc'));
69 $this->assertNotFalse(strpos($data['plugin_end_zone'][0], 'embed.min.js'));
73 * Test isso plugin when multiple links are displayed (shouldn't be displayed).
75 function testIssoMultipleLinks()
77 $conf = new ConfigManager('');
78 $conf->set('plugins.ISSO_SERVER', 'value');
80 $str = 'http://randomstr.com/test';
95 $processed = hook_isso_render_linklist($data, $conf);
96 // data shouldn't be altered
97 $this->assertEquals($data, $processed);
101 * Test isso plugin when using search (shouldn't be displayed).
103 function testIssoNotDisplayedWhenSearch()
105 $conf = new ConfigManager('');
106 $conf->set('plugins.ISSO_SERVER', 'value');
108 $str = 'http://randomstr.com/test';
117 'search_term' => $str
120 $processed = hook_isso_render_linklist($data, $conf);
122 // data shouldn't be altered
123 $this->assertEquals($data, $processed);
127 * Test isso plugin without server configuration (shouldn't be displayed).
129 function testIssoWithoutConf()
132 $conf = new ConfigManager('');
133 $processed = hook_isso_render_linklist($data, $conf);
134 $this->assertEquals($data, $processed);