diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-06-09 20:04:32 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-06-11 09:30:56 +0200 |
commit | 51def0d84955c7a951bd091eb5eeb3fce9deabd4 (patch) | |
tree | 466c24f215ee4d25bdcce67100b11e2fd3b0c78b /tests/plugins | |
parent | 278d9ee2836df7d805845077f26f8cecd16f0f4f (diff) | |
download | Shaarli-51def0d84955c7a951bd091eb5eeb3fce9deabd4.tar.gz Shaarli-51def0d84955c7a951bd091eb5eeb3fce9deabd4.tar.zst Shaarli-51def0d84955c7a951bd091eb5eeb3fce9deabd4.zip |
PluginManager no longer uses singleton pattern
Diffstat (limited to 'tests/plugins')
-rw-r--r-- | tests/plugins/PluginReadityourselfTest.php | 10 | ||||
-rw-r--r-- | tests/plugins/PluginWallabagTest.php | 7 |
2 files changed, 10 insertions, 7 deletions
diff --git a/tests/plugins/PluginReadityourselfTest.php b/tests/plugins/PluginReadityourselfTest.php index bc5da042..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(''); | ||
7 | require_once 'plugins/readityourself/readityourself.php'; | 9 | require_once 'plugins/readityourself/readityourself.php'; |
8 | 10 | ||
9 | /** | 11 | /** |
@@ -25,7 +27,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase | |||
25 | */ | 27 | */ |
26 | function testReadityourselfLinklist() | 28 | function testReadityourselfLinklist() |
27 | { | 29 | { |
28 | $conf = ConfigManager::getInstance(); | 30 | $conf = new ConfigManager(''); |
29 | $conf->set('plugins.READITYOUSELF_URL', 'value'); | 31 | $conf->set('plugins.READITYOUSELF_URL', 'value'); |
30 | $str = 'http://randomstr.com/test'; | 32 | $str = 'http://randomstr.com/test'; |
31 | $data = array( | 33 | $data = array( |
@@ -37,7 +39,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase | |||
37 | ) | 39 | ) |
38 | ); | 40 | ); |
39 | 41 | ||
40 | $data = hook_readityourself_render_linklist($data); | 42 | $data = hook_readityourself_render_linklist($data, $conf); |
41 | $link = $data['links'][0]; | 43 | $link = $data['links'][0]; |
42 | // data shouldn't be altered | 44 | // data shouldn't be altered |
43 | $this->assertEquals($str, $data['title']); | 45 | $this->assertEquals($str, $data['title']); |
@@ -53,7 +55,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase | |||
53 | */ | 55 | */ |
54 | function testReadityourselfLinklistWithoutConfig() | 56 | function testReadityourselfLinklistWithoutConfig() |
55 | { | 57 | { |
56 | $conf = ConfigManager::getInstance(); | 58 | $conf = new ConfigManager(''); |
57 | $conf->set('plugins.READITYOUSELF_URL', null); | 59 | $conf->set('plugins.READITYOUSELF_URL', null); |
58 | $str = 'http://randomstr.com/test'; | 60 | $str = 'http://randomstr.com/test'; |
59 | $data = array( | 61 | $data = array( |
@@ -65,7 +67,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase | |||
65 | ) | 67 | ) |
66 | ); | 68 | ); |
67 | 69 | ||
68 | $data = hook_readityourself_render_linklist($data); | 70 | $data = hook_readityourself_render_linklist($data, $conf); |
69 | $link = $data['links'][0]; | 71 | $link = $data['links'][0]; |
70 | // data shouldn't be altered | 72 | // data shouldn't be altered |
71 | $this->assertEquals($str, $data['title']); | 73 | $this->assertEquals($str, $data['title']); |
diff --git a/tests/plugins/PluginWallabagTest.php b/tests/plugins/PluginWallabagTest.php index e6f8a8b6..302ee296 100644 --- a/tests/plugins/PluginWallabagTest.php +++ b/tests/plugins/PluginWallabagTest.php | |||
@@ -4,6 +4,8 @@ | |||
4 | * PluginWallabagTest.php.php | 4 | * PluginWallabagTest.php.php |
5 | */ | 5 | */ |
6 | 6 | ||
7 | // FIXME! add an init method. | ||
8 | $conf = new ConfigManager(''); | ||
7 | require_once 'plugins/wallabag/wallabag.php'; | 9 | require_once 'plugins/wallabag/wallabag.php'; |
8 | 10 | ||
9 | /** | 11 | /** |
@@ -25,7 +27,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase | |||
25 | */ | 27 | */ |
26 | function testWallabagLinklist() | 28 | function testWallabagLinklist() |
27 | { | 29 | { |
28 | $conf = ConfigManager::getInstance(); | 30 | $conf = new ConfigManager(''); |
29 | $conf->set('plugins.WALLABAG_URL', 'value'); | 31 | $conf->set('plugins.WALLABAG_URL', 'value'); |
30 | $str = 'http://randomstr.com/test'; | 32 | $str = 'http://randomstr.com/test'; |
31 | $data = array( | 33 | $data = array( |
@@ -37,7 +39,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase | |||
37 | ) | 39 | ) |
38 | ); | 40 | ); |
39 | 41 | ||
40 | $data = hook_wallabag_render_linklist($data); | 42 | $data = hook_wallabag_render_linklist($data, $conf); |
41 | $link = $data['links'][0]; | 43 | $link = $data['links'][0]; |
42 | // data shouldn't be altered | 44 | // data shouldn't be altered |
43 | $this->assertEquals($str, $data['title']); | 45 | $this->assertEquals($str, $data['title']); |
@@ -49,4 +51,3 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase | |||
49 | $this->assertNotFalse(strpos($link['link_plugin'][0], $conf->get('plugins.WALLABAG_URL'))); | 51 | $this->assertNotFalse(strpos($link['link_plugin'][0], $conf->get('plugins.WALLABAG_URL'))); |
50 | } | 52 | } |
51 | } | 53 | } |
52 | |||