X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fplugins%2FPluginWallabagTest.php;h=36317215976e4a5c38fe8bf721525b903d764d8d;hb=a5a9cf23acd1248585173aa32757d9720b5f2d62;hp=7cc83f4f7fc2515e41e1a40bc253a2c91d04eb1e;hpb=fd006c630b64146edc402b68d8503c716f8a55d6;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/plugins/PluginWallabagTest.php b/tests/plugins/PluginWallabagTest.php index 7cc83f4f..36317215 100644 --- a/tests/plugins/PluginWallabagTest.php +++ b/tests/plugins/PluginWallabagTest.php @@ -1,8 +1,8 @@ set('plugins.WALLABAG_URL', 'value'); + $errors = wallabag_init($conf); + $this->assertEmpty($errors); + } + + /** + * Test wallabag init with errors. + */ + public function testWallabagInitError() + { + $conf = new ConfigManager(''); + $errors = wallabag_init($conf); + $this->assertNotEmpty($errors); + } + /** * Test render_linklist hook. */ - function testWallabagLinklist() + public function testWallabagLinklist() { - $GLOBALS['plugins']['WALLABAG_URL'] = 'value'; + $conf = new ConfigManager(''); + $conf->set('plugins.WALLABAG_URL', 'value'); $str = 'http://randomstr.com/test'; $data = array( 'title' => $str, @@ -36,7 +58,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase ) ); - $data = hook_wallabag_render_linklist($data); + $data = hook_wallabag_render_linklist($data, $conf); $link = $data['links'][0]; // data shouldn't be altered $this->assertEquals($str, $data['title']); @@ -44,6 +66,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase // plugin data $this->assertEquals(1, count($link['link_plugin'])); - $this->assertNotFalse(strpos($link['link_plugin'][0], $str)); + $this->assertNotFalse(strpos($link['link_plugin'][0], urlencode($str))); + $this->assertNotFalse(strpos($link['link_plugin'][0], $conf->get('plugins.WALLABAG_URL'))); } }