diff options
Diffstat (limited to 'tests/plugins/PluginWallabagTest.php')
-rw-r--r-- | tests/plugins/PluginWallabagTest.php | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/tests/plugins/PluginWallabagTest.php b/tests/plugins/PluginWallabagTest.php index 5d3a60e0..2c268cbd 100644 --- a/tests/plugins/PluginWallabagTest.php +++ b/tests/plugins/PluginWallabagTest.php | |||
@@ -21,11 +21,33 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase | |||
21 | } | 21 | } |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Test wallabag init without errors. | ||
25 | */ | ||
26 | function testWallabagInitNoError() | ||
27 | { | ||
28 | $conf = new ConfigManager(''); | ||
29 | $conf->set('plugins.WALLABAG_URL', 'value'); | ||
30 | $errors = wallabag_init($conf); | ||
31 | $this->assertEmpty($errors); | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * Test wallabag init with errors. | ||
36 | */ | ||
37 | function testWallabagInitError() | ||
38 | { | ||
39 | $conf = new ConfigManager(''); | ||
40 | $errors = wallabag_init($conf); | ||
41 | $this->assertNotEmpty($errors); | ||
42 | } | ||
43 | |||
44 | /** | ||
24 | * Test render_linklist hook. | 45 | * Test render_linklist hook. |
25 | */ | 46 | */ |
26 | function testWallabagLinklist() | 47 | function testWallabagLinklist() |
27 | { | 48 | { |
28 | $GLOBALS['plugins']['WALLABAG_URL'] = 'value'; | 49 | $conf = new ConfigManager(''); |
50 | $conf->set('plugins.WALLABAG_URL', 'value'); | ||
29 | $str = 'http://randomstr.com/test'; | 51 | $str = 'http://randomstr.com/test'; |
30 | $data = array( | 52 | $data = array( |
31 | 'title' => $str, | 53 | 'title' => $str, |
@@ -36,7 +58,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase | |||
36 | ) | 58 | ) |
37 | ); | 59 | ); |
38 | 60 | ||
39 | $data = hook_wallabag_render_linklist($data); | 61 | $data = hook_wallabag_render_linklist($data, $conf); |
40 | $link = $data['links'][0]; | 62 | $link = $data['links'][0]; |
41 | // data shouldn't be altered | 63 | // data shouldn't be altered |
42 | $this->assertEquals($str, $data['title']); | 64 | $this->assertEquals($str, $data['title']); |
@@ -45,7 +67,6 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase | |||
45 | // plugin data | 67 | // plugin data |
46 | $this->assertEquals(1, count($link['link_plugin'])); | 68 | $this->assertEquals(1, count($link['link_plugin'])); |
47 | $this->assertNotFalse(strpos($link['link_plugin'][0], urlencode($str))); | 69 | $this->assertNotFalse(strpos($link['link_plugin'][0], urlencode($str))); |
48 | $this->assertNotFalse(strpos($link['link_plugin'][0], $GLOBALS['plugins']['WALLABAG_URL'])); | 70 | $this->assertNotFalse(strpos($link['link_plugin'][0], $conf->get('plugins.WALLABAG_URL'))); |
49 | } | 71 | } |
50 | } | 72 | } |
51 | |||