diff options
author | Arthur <arthur@hoa.ro> | 2015-11-07 16:52:41 +0100 |
---|---|---|
committer | Arthur <arthur@hoa.ro> | 2015-11-07 16:52:41 +0100 |
commit | 1b4ea59f93386594a6e6f35e581244b65c2db57f (patch) | |
tree | bf1da3832056f942227ac4173e3a27dc9e33508f /tests/plugins/PluginArchiveorgTest.php | |
parent | a52e8435939c641f964939f1df55cf7ceddcc0fd (diff) | |
parent | 9a364c283e3e9b5ccb5fc7a9a8e2946b1918c6a5 (diff) | |
download | Shaarli-1b4ea59f93386594a6e6f35e581244b65c2db57f.tar.gz Shaarli-1b4ea59f93386594a6e6f35e581244b65c2db57f.tar.zst Shaarli-1b4ea59f93386594a6e6f35e581244b65c2db57f.zip |
Merge pull request #283 from ArthurHoaro/plugin-archiveorg
PLUGIN archiveorg
Diffstat (limited to 'tests/plugins/PluginArchiveorgTest.php')
-rw-r--r-- | tests/plugins/PluginArchiveorgTest.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/plugins/PluginArchiveorgTest.php b/tests/plugins/PluginArchiveorgTest.php new file mode 100644 index 00000000..dbc52bc8 --- /dev/null +++ b/tests/plugins/PluginArchiveorgTest.php | |||
@@ -0,0 +1,48 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * PluginArchiveorgTest.php | ||
5 | */ | ||
6 | |||
7 | require_once 'plugins/archiveorg/archiveorg.php'; | ||
8 | |||
9 | /** | ||
10 | * Class PlugQrcodeTest | ||
11 | * Unit test for the QR-Code plugin | ||
12 | */ | ||
13 | class PluginArchiveorgTest 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 testArchiveorgLinklist() | ||
27 | { | ||
28 | $str = 'http://randomstr.com/test'; | ||
29 | $data = array( | ||
30 | 'title' => $str, | ||
31 | 'links' => array( | ||
32 | array( | ||
33 | 'url' => $str, | ||
34 | ) | ||
35 | ) | ||
36 | ); | ||
37 | |||
38 | $data = hook_archiveorg_render_linklist($data); | ||
39 | $link = $data['links'][0]; | ||
40 | // data shouldn't be altered | ||
41 | $this->assertEquals($str, $data['title']); | ||
42 | $this->assertEquals($str, $link['url']); | ||
43 | |||
44 | // plugin data | ||
45 | $this->assertEquals(1, count($link['link_plugin'])); | ||
46 | $this->assertNotFalse(strpos($link['link_plugin'][0], $str)); | ||
47 | } | ||
48 | } | ||