aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/plugins/PluginReadityourselfTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/plugins/PluginReadityourselfTest.php')
-rw-r--r--tests/plugins/PluginReadityourselfTest.php31
1 files changed, 27 insertions, 4 deletions
diff --git a/tests/plugins/PluginReadityourselfTest.php b/tests/plugins/PluginReadityourselfTest.php
index 8bf17bf1..532db146 100644
--- a/tests/plugins/PluginReadityourselfTest.php
+++ b/tests/plugins/PluginReadityourselfTest.php
@@ -21,11 +21,33 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
21 } 21 }
22 22
23 /** 23 /**
24 * Test Readityourself init without errors.
25 */
26 function testReadityourselfInitNoError()
27 {
28 $conf = new ConfigManager('');
29 $conf->set('plugins.READITYOUSELF_URL', 'value');
30 $errors = readityourself_init($conf);
31 $this->assertEmpty($errors);
32 }
33
34 /**
35 * Test Readityourself init with errors.
36 */
37 function testReadityourselfInitError()
38 {
39 $conf = new ConfigManager('');
40 $errors = readityourself_init($conf);
41 $this->assertNotEmpty($errors);
42 }
43
44 /**
24 * Test render_linklist hook. 45 * Test render_linklist hook.
25 */ 46 */
26 function testReadityourselfLinklist() 47 function testReadityourselfLinklist()
27 { 48 {
28 $GLOBALS['plugins']['READITYOUSELF_URL'] = 'value'; 49 $conf = new ConfigManager('');
50 $conf->set('plugins.READITYOUSELF_URL', 'value');
29 $str = 'http://randomstr.com/test'; 51 $str = 'http://randomstr.com/test';
30 $data = array( 52 $data = array(
31 'title' => $str, 53 'title' => $str,
@@ -36,7 +58,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
36 ) 58 )
37 ); 59 );
38 60
39 $data = hook_readityourself_render_linklist($data); 61 $data = hook_readityourself_render_linklist($data, $conf);
40 $link = $data['links'][0]; 62 $link = $data['links'][0];
41 // data shouldn't be altered 63 // data shouldn't be altered
42 $this->assertEquals($str, $data['title']); 64 $this->assertEquals($str, $data['title']);
@@ -52,7 +74,8 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
52 */ 74 */
53 function testReadityourselfLinklistWithoutConfig() 75 function testReadityourselfLinklistWithoutConfig()
54 { 76 {
55 unset($GLOBALS['plugins']['READITYOUSELF_URL']); 77 $conf = new ConfigManager('');
78 $conf->set('plugins.READITYOUSELF_URL', null);
56 $str = 'http://randomstr.com/test'; 79 $str = 'http://randomstr.com/test';
57 $data = array( 80 $data = array(
58 'title' => $str, 81 'title' => $str,
@@ -63,7 +86,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
63 ) 86 )
64 ); 87 );
65 88
66 $data = hook_readityourself_render_linklist($data); 89 $data = hook_readityourself_render_linklist($data, $conf);
67 $link = $data['links'][0]; 90 $link = $data['links'][0];
68 // data shouldn't be altered 91 // data shouldn't be altered
69 $this->assertEquals($str, $data['title']); 92 $this->assertEquals($str, $data['title']);