diff options
author | Arthur <arthur@hoa.ro> | 2015-11-08 13:29:32 +0100 |
---|---|---|
committer | Arthur <arthur@hoa.ro> | 2015-11-08 13:29:32 +0100 |
commit | fd006c630b64146edc402b68d8503c716f8a55d6 (patch) | |
tree | e53904cc6232c7f2fe8e1de6f23c9a5d6c5403ad /tests/plugins/PluginWallabagTest.php | |
parent | 70df947af60afb05529024bb2d3825eaf6cc7950 (diff) | |
parent | 056107ab4eae0a4867cf8d55de77d31f8868b899 (diff) | |
download | Shaarli-fd006c630b64146edc402b68d8503c716f8a55d6.tar.gz Shaarli-fd006c630b64146edc402b68d8503c716f8a55d6.tar.zst Shaarli-fd006c630b64146edc402b68d8503c716f8a55d6.zip |
Merge pull request #275 from shaarli/plugin-proposition
Plugin proposition
Diffstat (limited to 'tests/plugins/PluginWallabagTest.php')
-rw-r--r-- | tests/plugins/PluginWallabagTest.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/plugins/PluginWallabagTest.php b/tests/plugins/PluginWallabagTest.php new file mode 100644 index 00000000..7cc83f4f --- /dev/null +++ b/tests/plugins/PluginWallabagTest.php | |||
@@ -0,0 +1,49 @@ | |||
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 | { | ||
28 | $GLOBALS['plugins']['WALLABAG_URL'] = 'value'; | ||
29 | $str = 'http://randomstr.com/test'; | ||
30 | $data = array( | ||
31 | 'title' => $str, | ||
32 | 'links' => array( | ||
33 | array( | ||
34 | 'url' => $str, | ||
35 | ) | ||
36 | ) | ||
37 | ); | ||
38 | |||
39 | $data = hook_wallabag_render_linklist($data); | ||
40 | $link = $data['links'][0]; | ||
41 | // data shouldn't be altered | ||
42 | $this->assertEquals($str, $data['title']); | ||
43 | $this->assertEquals($str, $link['url']); | ||
44 | |||
45 | // plugin data | ||
46 | $this->assertEquals(1, count($link['link_plugin'])); | ||
47 | $this->assertNotFalse(strpos($link['link_plugin'][0], $str)); | ||
48 | } | ||
49 | } | ||