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