X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fplugins%2FPluginWallabagTest.php;h=9a402fb75a177fd585c65778f9322d811f74adcf;hb=bf02f8ba8e2864ff0cd12ac098b6e04e497cead9;hp=2c268cbd1b714b3b9aa1c29891bbf40e8592b24a;hpb=06eec9bf764662cd328627247a1f43e4abd3c5ad;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/plugins/PluginWallabagTest.php b/tests/plugins/PluginWallabagTest.php index 2c268cbd..9a402fb7 100644 --- a/tests/plugins/PluginWallabagTest.php +++ b/tests/plugins/PluginWallabagTest.php @@ -1,8 +1,8 @@ set('plugins.WALLABAG_URL', 'value'); @@ -34,7 +34,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase /** * Test wallabag init with errors. */ - function testWallabagInitError() + public function testWallabagInitError() { $conf = new ConfigManager(''); $errors = wallabag_init($conf); @@ -44,19 +44,20 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase /** * Test render_linklist hook. */ - function testWallabagLinklist() + public function testWallabagLinklist() { $conf = new ConfigManager(''); $conf->set('plugins.WALLABAG_URL', 'value'); $str = 'http://randomstr.com/test'; - $data = array( + $data = [ 'title' => $str, - 'links' => array( - array( + 'links' => [ + [ 'url' => $str, - ) - ) - ); + ] + ], + '_LOGGEDIN_' => true, + ]; $data = hook_wallabag_render_linklist($data, $conf); $link = $data['links'][0]; @@ -69,4 +70,26 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase $this->assertNotFalse(strpos($link['link_plugin'][0], urlencode($str))); $this->assertNotFalse(strpos($link['link_plugin'][0], $conf->get('plugins.WALLABAG_URL'))); } + + /** + * Test render_linklist hook while logged out: no change. + */ + public function testWallabagLinklistLoggedOut(): void + { + $conf = new ConfigManager(''); + $str = 'http://randomstr.com/test'; + $data = [ + 'title' => $str, + 'links' => [ + [ + 'url' => $str, + ] + ], + '_LOGGEDIN_' => false, + ]; + + $result = hook_wallabag_render_linklist($data, $conf); + + static::assertSame($data, $result); + } }