From 7fde6de1212323418401c15efba06026c704ca87 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Fri, 14 Oct 2016 13:22:58 +0200 Subject: 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. --- tests/plugins/PluginReadityourselfTest.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'tests/plugins/PluginReadityourselfTest.php') diff --git a/tests/plugins/PluginReadityourselfTest.php b/tests/plugins/PluginReadityourselfTest.php index d73e666a..532db146 100644 --- a/tests/plugins/PluginReadityourselfTest.php +++ b/tests/plugins/PluginReadityourselfTest.php @@ -4,8 +4,6 @@ * PluginReadityourselfTest.php.php */ -// FIXME! add an init method. -$conf = new ConfigManager(''); require_once 'plugins/readityourself/readityourself.php'; /** @@ -22,6 +20,27 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase PluginManager::$PLUGINS_PATH = 'plugins'; } + /** + * Test Readityourself init without errors. + */ + function testReadityourselfInitNoError() + { + $conf = new ConfigManager(''); + $conf->set('plugins.READITYOUSELF_URL', 'value'); + $errors = readityourself_init($conf); + $this->assertEmpty($errors); + } + + /** + * Test Readityourself init with errors. + */ + function testReadityourselfInitError() + { + $conf = new ConfigManager(''); + $errors = readityourself_init($conf); + $this->assertNotEmpty($errors); + } + /** * Test render_linklist hook. */ -- cgit v1.2.3