From 93b1fe54fb99efff30eec0d405cc7319fbbc1f95 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Thu, 5 Jan 2017 19:33:06 +0100 Subject: Cleanup: explicit method visibility Signed-off-by: VirtualTam --- tests/plugins/PlugQrcodeTest.php | 67 ------------------------------ tests/plugins/PluginAddlinkTest.php | 10 ++--- tests/plugins/PluginArchiveorgTest.php | 10 ++--- tests/plugins/PluginIssoTest.php | 14 +++---- tests/plugins/PluginMarkdownTest.php | 20 ++++----- tests/plugins/PluginPlayvideosTest.php | 6 +-- tests/plugins/PluginPubsubhubbubTest.php | 6 +-- tests/plugins/PluginQrcodeTest.php | 67 ++++++++++++++++++++++++++++++ tests/plugins/PluginReadityourselfTest.php | 10 ++--- tests/plugins/PluginWallabagTest.php | 8 ++-- tests/plugins/WallabagInstanceTest.php | 8 ++-- 11 files changed, 111 insertions(+), 115 deletions(-) delete mode 100644 tests/plugins/PlugQrcodeTest.php create mode 100644 tests/plugins/PluginQrcodeTest.php (limited to 'tests/plugins') diff --git a/tests/plugins/PlugQrcodeTest.php b/tests/plugins/PlugQrcodeTest.php deleted file mode 100644 index 86dc7f29..00000000 --- a/tests/plugins/PlugQrcodeTest.php +++ /dev/null @@ -1,67 +0,0 @@ - $str, - 'links' => array( - array( - 'url' => $str, - ) - ) - ); - - $data = hook_qrcode_render_linklist($data); - $link = $data['links'][0]; - // data shouldn't be altered - $this->assertEquals($str, $data['title']); - $this->assertEquals($str, $link['url']); - - // plugin data - $this->assertEquals(1, count($link['link_plugin'])); - $this->assertNotFalse(strpos($link['link_plugin'][0], $str)); - } - - /** - * Test render_footer hook. - */ - function testQrcodeFooter() - { - $str = 'stuff'; - $data = array($str => $str); - $data['_PAGE_'] = Router::$PAGE_LINKLIST; - - $data = hook_qrcode_render_footer($data); - $this->assertEquals($str, $data[$str]); - $this->assertEquals(1, count($data['js_files'])); - - $data = array($str => $str); - $data['_PAGE_'] = $str; - $this->assertEquals($str, $data[$str]); - $this->assertArrayNotHasKey('js_files', $data); - } -} diff --git a/tests/plugins/PluginAddlinkTest.php b/tests/plugins/PluginAddlinkTest.php index a2f25bec..b77fe12a 100644 --- a/tests/plugins/PluginAddlinkTest.php +++ b/tests/plugins/PluginAddlinkTest.php @@ -16,7 +16,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase /** * Reset plugin path. */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -24,7 +24,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase /** * Test render_header hook while logged in. */ - function testAddlinkHeaderLoggedIn() + public function testAddlinkHeaderLoggedIn() { $str = 'stuff'; $data = array($str => $str); @@ -46,7 +46,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase /** * Test render_header hook while logged out. */ - function testAddlinkHeaderLoggedOut() + public function testAddlinkHeaderLoggedOut() { $str = 'stuff'; $data = array($str => $str); @@ -61,7 +61,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase /** * Test render_includes hook while logged in. */ - function testAddlinkIncludesLoggedIn() + public function testAddlinkIncludesLoggedIn() { $str = 'stuff'; $data = array($str => $str); @@ -86,7 +86,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase * Test render_includes hook. * Should not affect css files while logged out. */ - function testAddlinkIncludesLoggedOut() + public function testAddlinkIncludesLoggedOut() { $str = 'stuff'; $data = array($str => $str); diff --git a/tests/plugins/PluginArchiveorgTest.php b/tests/plugins/PluginArchiveorgTest.php index 4daa4c9d..fecd5f2c 100644 --- a/tests/plugins/PluginArchiveorgTest.php +++ b/tests/plugins/PluginArchiveorgTest.php @@ -15,7 +15,7 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -23,7 +23,7 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase /** * Test render_linklist hook on external links. */ - function testArchiveorgLinklistOnExternalLinks() + public function testArchiveorgLinklistOnExternalLinks() { $str = 'http://randomstr.com/test'; @@ -48,13 +48,12 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase // plugin data $this->assertEquals(1, count($link['link_plugin'])); $this->assertNotFalse(strpos($link['link_plugin'][0], $str)); - } /** * Test render_linklist hook on internal links. */ - function testArchiveorgLinklistOnInternalLinks() + public function testArchiveorgLinklistOnInternalLinks() { $internalLink1 = 'http://shaarli.shaarli/?qvMAqg'; $internalLinkRealURL1 = '?qvMAqg'; @@ -101,7 +100,6 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase ) ); - $data = hook_archiveorg_render_linklist($data); // Case n°1: first link type, public @@ -136,7 +134,5 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase $link = $data['links'][5]; $this->assertArrayNotHasKey('link_plugin', $link); - } - } diff --git a/tests/plugins/PluginIssoTest.php b/tests/plugins/PluginIssoTest.php index 6b7904dd..03def208 100644 --- a/tests/plugins/PluginIssoTest.php +++ b/tests/plugins/PluginIssoTest.php @@ -12,7 +12,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -20,7 +20,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test Isso init without errors. */ - function testWallabagInitNoError() + public function testWallabagInitNoError() { $conf = new ConfigManager(''); $conf->set('plugins.ISSO_SERVER', 'value'); @@ -31,7 +31,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test Isso init with errors. */ - function testWallabagInitError() + public function testWallabagInitError() { $conf = new ConfigManager(''); $errors = isso_init($conf); @@ -41,7 +41,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test render_linklist hook with valid settings to display the comment form. */ - function testIssoDisplayed() + public function testIssoDisplayed() { $conf = new ConfigManager(''); $conf->set('plugins.ISSO_SERVER', 'value'); @@ -81,7 +81,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test isso plugin when multiple links are displayed (shouldn't be displayed). */ - function testIssoMultipleLinks() + public function testIssoMultipleLinks() { $conf = new ConfigManager(''); $conf->set('plugins.ISSO_SERVER', 'value'); @@ -113,7 +113,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test isso plugin when using search (shouldn't be displayed). */ - function testIssoNotDisplayedWhenSearch() + public function testIssoNotDisplayedWhenSearch() { $conf = new ConfigManager(''); $conf->set('plugins.ISSO_SERVER', 'value'); @@ -141,7 +141,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase /** * Test isso plugin without server configuration (shouldn't be displayed). */ - function testIssoWithoutConf() + public function testIssoWithoutConf() { $data = 'abc'; $conf = new ConfigManager(''); diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index 17ef2280..d359b2a1 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php @@ -16,7 +16,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -25,7 +25,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase * Test render_linklist hook. * Only check that there is basic markdown rendering. */ - function testMarkdownLinklist() + public function testMarkdownLinklist() { $markdown = '# My title' . PHP_EOL . 'Very interesting content.'; $data = array( @@ -45,7 +45,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase * Test render_daily hook. * Only check that there is basic markdown rendering. */ - function testMarkdownDaily() + public function testMarkdownDaily() { $markdown = '# My title' . PHP_EOL . 'Very interesting content.'; $data = array( @@ -69,7 +69,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test reverse_text2clickable(). */ - function testReverseText2clickable() + public function testReverseText2clickable() { $text = 'stuff http://hello.there/is=someone#here otherstuff'; $clickableText = text2clickable($text, ''); @@ -80,7 +80,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test reverse_nl2br(). */ - function testReverseNl2br() + public function testReverseNl2br() { $text = 'stuff' . PHP_EOL . 'otherstuff'; $processedText = nl2br($text); @@ -91,7 +91,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test reverse_space2nbsp(). */ - function testReverseSpace2nbsp() + public function testReverseSpace2nbsp() { $text = ' stuff' . PHP_EOL . ' otherstuff and another'; $processedText = space2nbsp($text); @@ -102,7 +102,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test sanitize_html(). */ - function testSanitizeHtml() + public function testSanitizeHtml() { $input = '< script src="js.js"/>'; $input .= '< script attr>alert(\'xss\');'; @@ -119,7 +119,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test the no markdown tag. */ - function testNoMarkdownTag() + public function testNoMarkdownTag() { $str = 'All _work_ and `no play` makes Jack a *dull* boy.'; $data = array( @@ -158,7 +158,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test that a close value to nomarkdown is not understand as nomarkdown (previous value `.nomarkdown`). */ - function testNoMarkdownNotExcactlyMatching() + public function testNoMarkdownNotExcactlyMatching() { $str = 'All _work_ and `no play` makes Jack a *dull* boy.'; $data = array( @@ -176,7 +176,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test hashtag links processed with markdown. */ - function testMarkdownHashtagLinks() + public function testMarkdownHashtagLinks() { $md = file_get_contents('tests/plugins/resources/markdown.md'); $md = format_description($md); diff --git a/tests/plugins/PluginPlayvideosTest.php b/tests/plugins/PluginPlayvideosTest.php index be1ef774..29ad047f 100644 --- a/tests/plugins/PluginPlayvideosTest.php +++ b/tests/plugins/PluginPlayvideosTest.php @@ -16,7 +16,7 @@ class PluginPlayvideosTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -24,7 +24,7 @@ class PluginPlayvideosTest extends PHPUnit_Framework_TestCase /** * Test render_linklist hook. */ - function testPlayvideosHeader() + public function testPlayvideosHeader() { $str = 'stuff'; $data = array($str => $str); @@ -43,7 +43,7 @@ class PluginPlayvideosTest extends PHPUnit_Framework_TestCase /** * Test render_footer hook. */ - function testPlayvideosFooter() + public function testPlayvideosFooter() { $str = 'stuff'; $data = array($str => $str); diff --git a/tests/plugins/PluginPubsubhubbubTest.php b/tests/plugins/PluginPubsubhubbubTest.php index 24dd7a11..1bd87935 100644 --- a/tests/plugins/PluginPubsubhubbubTest.php +++ b/tests/plugins/PluginPubsubhubbubTest.php @@ -17,7 +17,7 @@ class PluginPubsubhubbubTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -25,7 +25,7 @@ class PluginPubsubhubbubTest extends PHPUnit_Framework_TestCase /** * Test render_feed hook with an RSS feed. */ - function testPubSubRssRenderFeed() + public function testPubSubRssRenderFeed() { $hub = 'http://domain.hub'; $conf = new ConfigManager(self::$configFile); @@ -40,7 +40,7 @@ class PluginPubsubhubbubTest extends PHPUnit_Framework_TestCase /** * Test render_feed hook with an ATOM feed. */ - function testPubSubAtomRenderFeed() + public function testPubSubAtomRenderFeed() { $hub = 'http://domain.hub'; $conf = new ConfigManager(self::$configFile); diff --git a/tests/plugins/PluginQrcodeTest.php b/tests/plugins/PluginQrcodeTest.php new file mode 100644 index 00000000..211ee89c --- /dev/null +++ b/tests/plugins/PluginQrcodeTest.php @@ -0,0 +1,67 @@ + $str, + 'links' => array( + array( + 'url' => $str, + ) + ) + ); + + $data = hook_qrcode_render_linklist($data); + $link = $data['links'][0]; + // data shouldn't be altered + $this->assertEquals($str, $data['title']); + $this->assertEquals($str, $link['url']); + + // plugin data + $this->assertEquals(1, count($link['link_plugin'])); + $this->assertNotFalse(strpos($link['link_plugin'][0], $str)); + } + + /** + * Test render_footer hook. + */ + public function testQrcodeFooter() + { + $str = 'stuff'; + $data = array($str => $str); + $data['_PAGE_'] = Router::$PAGE_LINKLIST; + + $data = hook_qrcode_render_footer($data); + $this->assertEquals($str, $data[$str]); + $this->assertEquals(1, count($data['js_files'])); + + $data = array($str => $str); + $data['_PAGE_'] = $str; + $this->assertEquals($str, $data[$str]); + $this->assertArrayNotHasKey('js_files', $data); + } +} diff --git a/tests/plugins/PluginReadityourselfTest.php b/tests/plugins/PluginReadityourselfTest.php index 532db146..30470ab7 100644 --- a/tests/plugins/PluginReadityourselfTest.php +++ b/tests/plugins/PluginReadityourselfTest.php @@ -15,7 +15,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -23,7 +23,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase /** * Test Readityourself init without errors. */ - function testReadityourselfInitNoError() + public function testReadityourselfInitNoError() { $conf = new ConfigManager(''); $conf->set('plugins.READITYOUSELF_URL', 'value'); @@ -34,7 +34,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase /** * Test Readityourself init with errors. */ - function testReadityourselfInitError() + public function testReadityourselfInitError() { $conf = new ConfigManager(''); $errors = readityourself_init($conf); @@ -44,7 +44,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase /** * Test render_linklist hook. */ - function testReadityourselfLinklist() + public function testReadityourselfLinklist() { $conf = new ConfigManager(''); $conf->set('plugins.READITYOUSELF_URL', 'value'); @@ -72,7 +72,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase /** * Test without config: nothing should happened. */ - function testReadityourselfLinklistWithoutConfig() + public function testReadityourselfLinklistWithoutConfig() { $conf = new ConfigManager(''); $conf->set('plugins.READITYOUSELF_URL', null); diff --git a/tests/plugins/PluginWallabagTest.php b/tests/plugins/PluginWallabagTest.php index 2c268cbd..30351f46 100644 --- a/tests/plugins/PluginWallabagTest.php +++ b/tests/plugins/PluginWallabagTest.php @@ -15,7 +15,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { PluginManager::$PLUGINS_PATH = 'plugins'; } @@ -23,7 +23,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase /** * Test wallabag init without errors. */ - function testWallabagInitNoError() + public function testWallabagInitNoError() { $conf = new ConfigManager(''); $conf->set('plugins.WALLABAG_URL', 'value'); @@ -34,7 +34,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase /** * Test wallabag init with errors. */ - function testWallabagInitError() + public function testWallabagInitError() { $conf = new ConfigManager(''); $errors = wallabag_init($conf); @@ -44,7 +44,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase /** * Test render_linklist hook. */ - function testWallabagLinklist() + public function testWallabagLinklist() { $conf = new ConfigManager(''); $conf->set('plugins.WALLABAG_URL', 'value'); diff --git a/tests/plugins/WallabagInstanceTest.php b/tests/plugins/WallabagInstanceTest.php index 7c14c1df..2c466871 100644 --- a/tests/plugins/WallabagInstanceTest.php +++ b/tests/plugins/WallabagInstanceTest.php @@ -15,7 +15,7 @@ class WallabagInstanceTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - function setUp() + public function setUp() { $this->instance = 'http://some.url'; } @@ -23,7 +23,7 @@ class WallabagInstanceTest extends PHPUnit_Framework_TestCase /** * Test WallabagInstance with API V1. */ - function testWallabagInstanceV1() + public function testWallabagInstanceV1() { $instance = new WallabagInstance($this->instance, 1); $expected = $this->instance . '/?plainurl='; @@ -34,7 +34,7 @@ class WallabagInstanceTest extends PHPUnit_Framework_TestCase /** * Test WallabagInstance with API V2. */ - function testWallabagInstanceV2() + public function testWallabagInstanceV2() { $instance = new WallabagInstance($this->instance, 2); $expected = $this->instance . '/bookmarklet?url='; @@ -45,7 +45,7 @@ class WallabagInstanceTest extends PHPUnit_Framework_TestCase /** * Test WallabagInstance with an invalid API version. */ - function testWallabagInstanceInvalidVersion() + public function testWallabagInstanceInvalidVersion() { $instance = new WallabagInstance($this->instance, false); $expected = $this->instance . '/?plainurl='; -- cgit v1.2.3