aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/plugins/PluginReadityourselfTest.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2015-11-08 12:45:19 +0100
committerArthur <arthur@hoa.ro>2015-11-08 12:45:19 +0100
commite760840feaf7eff6b3aae86545ff45231b9e3592 (patch)
tree5f56a61e929efd146470b367bafcf057f0a28b9a /tests/plugins/PluginReadityourselfTest.php
parent00c25040c523104e1b845fd71d1cd134a1a5e7ff (diff)
parentb11c8f25dfe3c684f2f39352e3acdeb660a069ac (diff)
downloadShaarli-e760840feaf7eff6b3aae86545ff45231b9e3592.tar.gz
Shaarli-e760840feaf7eff6b3aae86545ff45231b9e3592.tar.zst
Shaarli-e760840feaf7eff6b3aae86545ff45231b9e3592.zip
Merge pull request #280 from ArthurHoaro/plugin-readityourself
PLUGIN readityourself
Diffstat (limited to 'tests/plugins/PluginReadityourselfTest.php')
-rw-r--r--tests/plugins/PluginReadityourselfTest.php75
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/plugins/PluginReadityourselfTest.php b/tests/plugins/PluginReadityourselfTest.php
new file mode 100644
index 00000000..8bf17bf1
--- /dev/null
+++ b/tests/plugins/PluginReadityourselfTest.php
@@ -0,0 +1,75 @@
1<?php
2
3/**
4 * PluginReadityourselfTest.php.php
5 */
6
7require_once 'plugins/readityourself/readityourself.php';
8
9/**
10 * Class PluginWallabagTest
11 * Unit test for the Wallabag plugin
12 */
13class PluginReadityourselfTest 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 testReadityourselfLinklist()
27 {
28 $GLOBALS['plugins']['READITYOUSELF_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_readityourself_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
50 /**
51 * Test without config: nothing should happened.
52 */
53 function testReadityourselfLinklistWithoutConfig()
54 {
55 unset($GLOBALS['plugins']['READITYOUSELF_URL']);
56 $str = 'http://randomstr.com/test';
57 $data = array(
58 'title' => $str,
59 'links' => array(
60 array(
61 'url' => $str,
62 )
63 )
64 );
65
66 $data = hook_readityourself_render_linklist($data);
67 $link = $data['links'][0];
68 // data shouldn't be altered
69 $this->assertEquals($str, $data['title']);
70 $this->assertEquals($str, $link['url']);
71
72 // plugin data
73 $this->assertArrayNotHasKey('link_plugin', $link);
74 }
75}