]> git.immae.eu Git - github/shaarli/Shaarli.git/blob - tests/plugins/PluginWallabagTest.php
302ee296f023d4f8a97db2270cb08e79d6650e82
[github/shaarli/Shaarli.git] / tests / plugins / PluginWallabagTest.php
1 <?php
2
3 /**
4 * PluginWallabagTest.php.php
5 */
6
7 // FIXME! add an init method.
8 $conf = new ConfigManager('');
9 require_once 'plugins/wallabag/wallabag.php';
10
11 /**
12 * Class PluginWallabagTest
13 * Unit test for the Wallabag plugin
14 */
15 class PluginWallabagTest extends PHPUnit_Framework_TestCase
16 {
17 /**
18 * Reset plugin path
19 */
20 function setUp()
21 {
22 PluginManager::$PLUGINS_PATH = 'plugins';
23 }
24
25 /**
26 * Test render_linklist hook.
27 */
28 function testWallabagLinklist()
29 {
30 $conf = new ConfigManager('');
31 $conf->set('plugins.WALLABAG_URL', 'value');
32 $str = 'http://randomstr.com/test';
33 $data = array(
34 'title' => $str,
35 'links' => array(
36 array(
37 'url' => $str,
38 )
39 )
40 );
41
42 $data = hook_wallabag_render_linklist($data, $conf);
43 $link = $data['links'][0];
44 // data shouldn't be altered
45 $this->assertEquals($str, $data['title']);
46 $this->assertEquals($str, $link['url']);
47
48 // plugin data
49 $this->assertEquals(1, count($link['link_plugin']));
50 $this->assertNotFalse(strpos($link['link_plugin'][0], urlencode($str)));
51 $this->assertNotFalse(strpos($link['link_plugin'][0], $conf->get('plugins.WALLABAG_URL')));
52 }
53 }