diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-10-14 13:22:58 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-10-14 13:22:58 +0200 |
commit | 7fde6de1212323418401c15efba06026c704ca87 (patch) | |
tree | 63b7efe598d1c563eee939fe9be3505afff1d873 /tests/plugins/PluginWallabagTest.php | |
parent | f63632a6fb84594b8aeacb387a5cd17b4a841d2c (diff) | |
download | Shaarli-7fde6de1212323418401c15efba06026c704ca87.tar.gz Shaarli-7fde6de1212323418401c15efba06026c704ca87.tar.zst Shaarli-7fde6de1212323418401c15efba06026c704ca87.zip |
New init function for plugins, supports errors reporting
All plugins can optionally add an init function named `pluginname_init()` which is called when the plugin is loaded.
This function is aware of the config, and can return initialization errors, which are displayed in the header template.
Note that the previous error system hack no longer work.
Diffstat (limited to 'tests/plugins/PluginWallabagTest.php')
-rw-r--r-- | tests/plugins/PluginWallabagTest.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/plugins/PluginWallabagTest.php b/tests/plugins/PluginWallabagTest.php index 302ee296..2c268cbd 100644 --- a/tests/plugins/PluginWallabagTest.php +++ b/tests/plugins/PluginWallabagTest.php | |||
@@ -4,8 +4,6 @@ | |||
4 | * PluginWallabagTest.php.php | 4 | * PluginWallabagTest.php.php |
5 | */ | 5 | */ |
6 | 6 | ||
7 | // FIXME! add an init method. | ||
8 | $conf = new ConfigManager(''); | ||
9 | require_once 'plugins/wallabag/wallabag.php'; | 7 | require_once 'plugins/wallabag/wallabag.php'; |
10 | 8 | ||
11 | /** | 9 | /** |
@@ -23,6 +21,27 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase | |||
23 | } | 21 | } |
24 | 22 | ||
25 | /** | 23 | /** |
24 | * Test wallabag init without errors. | ||
25 | */ | ||
26 | function testWallabagInitNoError() | ||
27 | { | ||
28 | $conf = new ConfigManager(''); | ||
29 | $conf->set('plugins.WALLABAG_URL', 'value'); | ||
30 | $errors = wallabag_init($conf); | ||
31 | $this->assertEmpty($errors); | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * Test wallabag init with errors. | ||
36 | */ | ||
37 | function testWallabagInitError() | ||
38 | { | ||
39 | $conf = new ConfigManager(''); | ||
40 | $errors = wallabag_init($conf); | ||
41 | $this->assertNotEmpty($errors); | ||
42 | } | ||
43 | |||
44 | /** | ||
26 | * Test render_linklist hook. | 45 | * Test render_linklist hook. |
27 | */ | 46 | */ |
28 | function testWallabagLinklist() | 47 | function testWallabagLinklist() |