aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/plugins/PluginReadityourselfTest.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2016-07-09 07:19:48 +0200
committerGitHub <noreply@github.com>2016-07-09 07:19:48 +0200
commit649af5b501d2a90448242f53764ff693e9854039 (patch)
tree23cde80a7ee2949e552c48939ae22fa462cfa0fc /tests/plugins/PluginReadityourselfTest.php
parenta9cfa38df92bd2e1e2c00a67b6ac1516a2116ade (diff)
parent5ff23f02b80ec6ddee28dee869171ee8e3656b7c (diff)
downloadShaarli-649af5b501d2a90448242f53764ff693e9854039.tar.gz
Shaarli-649af5b501d2a90448242f53764ff693e9854039.tar.zst
Shaarli-649af5b501d2a90448242f53764ff693e9854039.zip
Merge pull request #570 from ArthurHoaro/config-manager
Introduce a configuration manager
Diffstat (limited to 'tests/plugins/PluginReadityourselfTest.php')
-rw-r--r--tests/plugins/PluginReadityourselfTest.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/plugins/PluginReadityourselfTest.php b/tests/plugins/PluginReadityourselfTest.php
index 8bf17bf1..d73e666a 100644
--- a/tests/plugins/PluginReadityourselfTest.php
+++ b/tests/plugins/PluginReadityourselfTest.php
@@ -4,6 +4,8 @@
4 * PluginReadityourselfTest.php.php 4 * PluginReadityourselfTest.php.php
5 */ 5 */
6 6
7// FIXME! add an init method.
8$conf = new ConfigManager('');
7require_once 'plugins/readityourself/readityourself.php'; 9require_once 'plugins/readityourself/readityourself.php';
8 10
9/** 11/**
@@ -25,7 +27,8 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
25 */ 27 */
26 function testReadityourselfLinklist() 28 function testReadityourselfLinklist()
27 { 29 {
28 $GLOBALS['plugins']['READITYOUSELF_URL'] = 'value'; 30 $conf = new ConfigManager('');
31 $conf->set('plugins.READITYOUSELF_URL', 'value');
29 $str = 'http://randomstr.com/test'; 32 $str = 'http://randomstr.com/test';
30 $data = array( 33 $data = array(
31 'title' => $str, 34 'title' => $str,
@@ -36,7 +39,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
36 ) 39 )
37 ); 40 );
38 41
39 $data = hook_readityourself_render_linklist($data); 42 $data = hook_readityourself_render_linklist($data, $conf);
40 $link = $data['links'][0]; 43 $link = $data['links'][0];
41 // data shouldn't be altered 44 // data shouldn't be altered
42 $this->assertEquals($str, $data['title']); 45 $this->assertEquals($str, $data['title']);
@@ -52,7 +55,8 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
52 */ 55 */
53 function testReadityourselfLinklistWithoutConfig() 56 function testReadityourselfLinklistWithoutConfig()
54 { 57 {
55 unset($GLOBALS['plugins']['READITYOUSELF_URL']); 58 $conf = new ConfigManager('');
59 $conf->set('plugins.READITYOUSELF_URL', null);
56 $str = 'http://randomstr.com/test'; 60 $str = 'http://randomstr.com/test';
57 $data = array( 61 $data = array(
58 'title' => $str, 62 'title' => $str,
@@ -63,7 +67,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
63 ) 67 )
64 ); 68 );
65 69
66 $data = hook_readityourself_render_linklist($data); 70 $data = hook_readityourself_render_linklist($data, $conf);
67 $link = $data['links'][0]; 71 $link = $data['links'][0];
68 // data shouldn't be altered 72 // data shouldn't be altered
69 $this->assertEquals($str, $data['title']); 73 $this->assertEquals($str, $data['title']);