<?php
+use Shaarli\Config\ConfigManager;
/**
* PluginReadityourselfTest.php.php
/**
* Reset plugin path
*/
- function setUp()
+ public function setUp()
{
PluginManager::$PLUGINS_PATH = 'plugins';
}
+ /**
+ * Test Readityourself init without errors.
+ */
+ public function testReadityourselfInitNoError()
+ {
+ $conf = new ConfigManager('');
+ $conf->set('plugins.READITYOUSELF_URL', 'value');
+ $errors = readityourself_init($conf);
+ $this->assertEmpty($errors);
+ }
+
+ /**
+ * Test Readityourself init with errors.
+ */
+ public function testReadityourselfInitError()
+ {
+ $conf = new ConfigManager('');
+ $errors = readityourself_init($conf);
+ $this->assertNotEmpty($errors);
+ }
+
/**
* Test render_linklist hook.
*/
- function testReadityourselfLinklist()
+ public function testReadityourselfLinklist()
{
- $GLOBALS['plugins']['READITYOUSELF_URL'] = 'value';
+ $conf = new ConfigManager('');
+ $conf->set('plugins.READITYOUSELF_URL', 'value');
$str = 'http://randomstr.com/test';
$data = array(
'title' => $str,
)
);
- $data = hook_readityourself_render_linklist($data);
+ $data = hook_readityourself_render_linklist($data, $conf);
$link = $data['links'][0];
// data shouldn't be altered
$this->assertEquals($str, $data['title']);
/**
* Test without config: nothing should happened.
*/
- function testReadityourselfLinklistWithoutConfig()
+ public function testReadityourselfLinklistWithoutConfig()
{
- unset($GLOBALS['plugins']['READITYOUSELF_URL']);
+ $conf = new ConfigManager('');
+ $conf->set('plugins.READITYOUSELF_URL', null);
$str = 'http://randomstr.com/test';
$data = array(
'title' => $str,
)
);
- $data = hook_readityourself_render_linklist($data);
+ $data = hook_readityourself_render_linklist($data, $conf);
$link = $data['links'][0];
// data shouldn't be altered
$this->assertEquals($str, $data['title']);