4 * PluginReadityourselfTest.php.php
7 require_once 'plugins/readityourself/readityourself.php';
10 * Class PluginWallabagTest
11 * Unit test for the Wallabag plugin
13 class PluginReadityourselfTest
extends PHPUnit_Framework_TestCase
20 PluginManager
::$PLUGINS_PATH = 'plugins';
24 * Test Readityourself init without errors.
26 function testReadityourselfInitNoError()
28 $conf = new ConfigManager('');
29 $conf->set('plugins.READITYOUSELF_URL', 'value');
30 $errors = readityourself_init($conf);
31 $this->assertEmpty($errors);
35 * Test Readityourself init with errors.
37 function testReadityourselfInitError()
39 $conf = new ConfigManager('');
40 $errors = readityourself_init($conf);
41 $this->assertNotEmpty($errors);
45 * Test render_linklist hook.
47 function testReadityourselfLinklist()
49 $conf = new ConfigManager('');
50 $conf->set('plugins.READITYOUSELF_URL', 'value');
51 $str = 'http://randomstr.com/test';
61 $data = hook_readityourself_render_linklist($data, $conf);
62 $link = $data['links'][0];
63 // data shouldn't be altered
64 $this->assertEquals($str, $data['title']);
65 $this->assertEquals($str, $link['url']);
68 $this->assertEquals(1, count($link['link_plugin']));
69 $this->assertNotFalse(strpos($link['link_plugin'][0], $str));
73 * Test without config: nothing should happened.
75 function testReadityourselfLinklistWithoutConfig()
77 $conf = new ConfigManager('');
78 $conf->set('plugins.READITYOUSELF_URL', null);
79 $str = 'http://randomstr.com/test';
89 $data = hook_readityourself_render_linklist($data, $conf);
90 $link = $data['links'][0];
91 // data shouldn't be altered
92 $this->assertEquals($str, $data['title']);
93 $this->assertEquals($str, $link['url']);
96 $this->assertArrayNotHasKey('link_plugin', $link);