aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Url/UrlTest.php8
-rw-r--r--tests/api/ApiUtilsTest.php15
-rw-r--r--tests/plugins/PluginAddlinkTest.php10
-rw-r--r--tests/plugins/PluginArchiveorgTest.php10
-rw-r--r--tests/plugins/PluginIssoTest.php14
-rw-r--r--tests/plugins/PluginMarkdownTest.php20
-rw-r--r--tests/plugins/PluginPlayvideosTest.php6
-rw-r--r--tests/plugins/PluginPubsubhubbubTest.php6
-rw-r--r--tests/plugins/PluginQrcodeTest.php (renamed from tests/plugins/PlugQrcodeTest.php)12
-rw-r--r--tests/plugins/PluginReadityourselfTest.php10
-rw-r--r--tests/plugins/PluginWallabagTest.php8
-rw-r--r--tests/plugins/WallabagInstanceTest.php8
12 files changed, 63 insertions, 64 deletions
diff --git a/tests/Url/UrlTest.php b/tests/Url/UrlTest.php
index 05862372..aa2f2234 100644
--- a/tests/Url/UrlTest.php
+++ b/tests/Url/UrlTest.php
@@ -157,7 +157,7 @@ class UrlTest extends PHPUnit_Framework_TestCase
157 /** 157 /**
158 * Test add trailing slash. 158 * Test add trailing slash.
159 */ 159 */
160 function testAddTrailingSlash() 160 public function testAddTrailingSlash()
161 { 161 {
162 $strOn = 'http://randomstr.com/test/'; 162 $strOn = 'http://randomstr.com/test/';
163 $strOff = 'http://randomstr.com/test'; 163 $strOff = 'http://randomstr.com/test';
@@ -168,7 +168,7 @@ class UrlTest extends PHPUnit_Framework_TestCase
168 /** 168 /**
169 * Test valid HTTP url. 169 * Test valid HTTP url.
170 */ 170 */
171 function testUrlIsHttp() 171 public function testUrlIsHttp()
172 { 172 {
173 $url = new Url(self::$baseUrl); 173 $url = new Url(self::$baseUrl);
174 $this->assertTrue($url->isHttp()); 174 $this->assertTrue($url->isHttp());
@@ -177,7 +177,7 @@ class UrlTest extends PHPUnit_Framework_TestCase
177 /** 177 /**
178 * Test non HTTP url. 178 * Test non HTTP url.
179 */ 179 */
180 function testUrlIsNotHttp() 180 public function testUrlIsNotHttp()
181 { 181 {
182 $url = new Url('ftp://save.tld/mysave'); 182 $url = new Url('ftp://save.tld/mysave');
183 $this->assertFalse($url->isHttp()); 183 $this->assertFalse($url->isHttp());
@@ -186,7 +186,7 @@ class UrlTest extends PHPUnit_Framework_TestCase
186 /** 186 /**
187 * Test International Domain Name to ASCII conversion 187 * Test International Domain Name to ASCII conversion
188 */ 188 */
189 function testIdnToAscii() 189 public function testIdnToAscii()
190 { 190 {
191 $ind = 'http://www.académie-française.fr/'; 191 $ind = 'http://www.académie-française.fr/';
192 $expected = 'http://www.xn--acadmie-franaise-npb1a.fr/'; 192 $expected = 'http://www.xn--acadmie-franaise-npb1a.fr/';
diff --git a/tests/api/ApiUtilsTest.php b/tests/api/ApiUtilsTest.php
index 10da1459..4b2fa3b2 100644
--- a/tests/api/ApiUtilsTest.php
+++ b/tests/api/ApiUtilsTest.php
@@ -2,6 +2,9 @@
2 2
3namespace Shaarli\Api; 3namespace Shaarli\Api;
4 4
5use Shaarli\Base64Url;
6
7
5/** 8/**
6 * Class ApiUtilsTest 9 * Class ApiUtilsTest
7 */ 10 */
@@ -24,14 +27,14 @@ class ApiUtilsTest extends \PHPUnit_Framework_TestCase
24 */ 27 */
25 public static function generateValidJwtToken($secret) 28 public static function generateValidJwtToken($secret)
26 { 29 {
27 $header = base64_encode('{ 30 $header = Base64Url::encode('{
28 "typ": "JWT", 31 "typ": "JWT",
29 "alg": "HS512" 32 "alg": "HS512"
30 }'); 33 }');
31 $payload = base64_encode('{ 34 $payload = Base64Url::encode('{
32 "iat": '. time() .' 35 "iat": '. time() .'
33 }'); 36 }');
34 $signature = hash_hmac('sha512', $header .'.'. $payload , $secret); 37 $signature = Base64Url::encode(hash_hmac('sha512', $header .'.'. $payload , $secret, true));
35 return $header .'.'. $payload .'.'. $signature; 38 return $header .'.'. $payload .'.'. $signature;
36 } 39 }
37 40
@@ -46,9 +49,9 @@ class ApiUtilsTest extends \PHPUnit_Framework_TestCase
46 */ 49 */
47 public static function generateCustomJwtToken($header, $payload, $secret) 50 public static function generateCustomJwtToken($header, $payload, $secret)
48 { 51 {
49 $header = base64_encode($header); 52 $header = Base64Url::encode($header);
50 $payload = base64_encode($payload); 53 $payload = Base64Url::encode($payload);
51 $signature = hash_hmac('sha512', $header . '.' . $payload, $secret); 54 $signature = Base64Url::encode(hash_hmac('sha512', $header . '.' . $payload, $secret, true));
52 return $header . '.' . $payload . '.' . $signature; 55 return $header . '.' . $payload . '.' . $signature;
53 } 56 }
54 57
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
16 /** 16 /**
17 * Reset plugin path. 17 * Reset plugin path.
18 */ 18 */
19 function setUp() 19 public function setUp()
20 { 20 {
21 PluginManager::$PLUGINS_PATH = 'plugins'; 21 PluginManager::$PLUGINS_PATH = 'plugins';
22 } 22 }
@@ -24,7 +24,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase
24 /** 24 /**
25 * Test render_header hook while logged in. 25 * Test render_header hook while logged in.
26 */ 26 */
27 function testAddlinkHeaderLoggedIn() 27 public function testAddlinkHeaderLoggedIn()
28 { 28 {
29 $str = 'stuff'; 29 $str = 'stuff';
30 $data = array($str => $str); 30 $data = array($str => $str);
@@ -46,7 +46,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase
46 /** 46 /**
47 * Test render_header hook while logged out. 47 * Test render_header hook while logged out.
48 */ 48 */
49 function testAddlinkHeaderLoggedOut() 49 public function testAddlinkHeaderLoggedOut()
50 { 50 {
51 $str = 'stuff'; 51 $str = 'stuff';
52 $data = array($str => $str); 52 $data = array($str => $str);
@@ -61,7 +61,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase
61 /** 61 /**
62 * Test render_includes hook while logged in. 62 * Test render_includes hook while logged in.
63 */ 63 */
64 function testAddlinkIncludesLoggedIn() 64 public function testAddlinkIncludesLoggedIn()
65 { 65 {
66 $str = 'stuff'; 66 $str = 'stuff';
67 $data = array($str => $str); 67 $data = array($str => $str);
@@ -86,7 +86,7 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase
86 * Test render_includes hook. 86 * Test render_includes hook.
87 * Should not affect css files while logged out. 87 * Should not affect css files while logged out.
88 */ 88 */
89 function testAddlinkIncludesLoggedOut() 89 public function testAddlinkIncludesLoggedOut()
90 { 90 {
91 $str = 'stuff'; 91 $str = 'stuff';
92 $data = array($str => $str); 92 $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
15 /** 15 /**
16 * Reset plugin path 16 * Reset plugin path
17 */ 17 */
18 function setUp() 18 public function setUp()
19 { 19 {
20 PluginManager::$PLUGINS_PATH = 'plugins'; 20 PluginManager::$PLUGINS_PATH = 'plugins';
21 } 21 }
@@ -23,7 +23,7 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase
23 /** 23 /**
24 * Test render_linklist hook on external links. 24 * Test render_linklist hook on external links.
25 */ 25 */
26 function testArchiveorgLinklistOnExternalLinks() 26 public function testArchiveorgLinklistOnExternalLinks()
27 { 27 {
28 $str = 'http://randomstr.com/test'; 28 $str = 'http://randomstr.com/test';
29 29
@@ -48,13 +48,12 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase
48 // plugin data 48 // plugin data
49 $this->assertEquals(1, count($link['link_plugin'])); 49 $this->assertEquals(1, count($link['link_plugin']));
50 $this->assertNotFalse(strpos($link['link_plugin'][0], $str)); 50 $this->assertNotFalse(strpos($link['link_plugin'][0], $str));
51
52 } 51 }
53 52
54 /** 53 /**
55 * Test render_linklist hook on internal links. 54 * Test render_linklist hook on internal links.
56 */ 55 */
57 function testArchiveorgLinklistOnInternalLinks() 56 public function testArchiveorgLinklistOnInternalLinks()
58 { 57 {
59 $internalLink1 = 'http://shaarli.shaarli/?qvMAqg'; 58 $internalLink1 = 'http://shaarli.shaarli/?qvMAqg';
60 $internalLinkRealURL1 = '?qvMAqg'; 59 $internalLinkRealURL1 = '?qvMAqg';
@@ -101,7 +100,6 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase
101 ) 100 )
102 ); 101 );
103 102
104
105 $data = hook_archiveorg_render_linklist($data); 103 $data = hook_archiveorg_render_linklist($data);
106 104
107 // Case n°1: first link type, public 105 // Case n°1: first link type, public
@@ -136,7 +134,5 @@ class PluginArchiveorgTest extends PHPUnit_Framework_TestCase
136 $link = $data['links'][5]; 134 $link = $data['links'][5];
137 135
138 $this->assertArrayNotHasKey('link_plugin', $link); 136 $this->assertArrayNotHasKey('link_plugin', $link);
139
140 } 137 }
141
142} 138}
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
12 /** 12 /**
13 * Reset plugin path 13 * Reset plugin path
14 */ 14 */
15 function setUp() 15 public function setUp()
16 { 16 {
17 PluginManager::$PLUGINS_PATH = 'plugins'; 17 PluginManager::$PLUGINS_PATH = 'plugins';
18 } 18 }
@@ -20,7 +20,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
20 /** 20 /**
21 * Test Isso init without errors. 21 * Test Isso init without errors.
22 */ 22 */
23 function testWallabagInitNoError() 23 public function testWallabagInitNoError()
24 { 24 {
25 $conf = new ConfigManager(''); 25 $conf = new ConfigManager('');
26 $conf->set('plugins.ISSO_SERVER', 'value'); 26 $conf->set('plugins.ISSO_SERVER', 'value');
@@ -31,7 +31,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
31 /** 31 /**
32 * Test Isso init with errors. 32 * Test Isso init with errors.
33 */ 33 */
34 function testWallabagInitError() 34 public function testWallabagInitError()
35 { 35 {
36 $conf = new ConfigManager(''); 36 $conf = new ConfigManager('');
37 $errors = isso_init($conf); 37 $errors = isso_init($conf);
@@ -41,7 +41,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
41 /** 41 /**
42 * Test render_linklist hook with valid settings to display the comment form. 42 * Test render_linklist hook with valid settings to display the comment form.
43 */ 43 */
44 function testIssoDisplayed() 44 public function testIssoDisplayed()
45 { 45 {
46 $conf = new ConfigManager(''); 46 $conf = new ConfigManager('');
47 $conf->set('plugins.ISSO_SERVER', 'value'); 47 $conf->set('plugins.ISSO_SERVER', 'value');
@@ -81,7 +81,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
81 /** 81 /**
82 * Test isso plugin when multiple links are displayed (shouldn't be displayed). 82 * Test isso plugin when multiple links are displayed (shouldn't be displayed).
83 */ 83 */
84 function testIssoMultipleLinks() 84 public function testIssoMultipleLinks()
85 { 85 {
86 $conf = new ConfigManager(''); 86 $conf = new ConfigManager('');
87 $conf->set('plugins.ISSO_SERVER', 'value'); 87 $conf->set('plugins.ISSO_SERVER', 'value');
@@ -113,7 +113,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
113 /** 113 /**
114 * Test isso plugin when using search (shouldn't be displayed). 114 * Test isso plugin when using search (shouldn't be displayed).
115 */ 115 */
116 function testIssoNotDisplayedWhenSearch() 116 public function testIssoNotDisplayedWhenSearch()
117 { 117 {
118 $conf = new ConfigManager(''); 118 $conf = new ConfigManager('');
119 $conf->set('plugins.ISSO_SERVER', 'value'); 119 $conf->set('plugins.ISSO_SERVER', 'value');
@@ -141,7 +141,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
141 /** 141 /**
142 * Test isso plugin without server configuration (shouldn't be displayed). 142 * Test isso plugin without server configuration (shouldn't be displayed).
143 */ 143 */
144 function testIssoWithoutConf() 144 public function testIssoWithoutConf()
145 { 145 {
146 $data = 'abc'; 146 $data = 'abc';
147 $conf = new ConfigManager(''); 147 $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
16 /** 16 /**
17 * Reset plugin path 17 * Reset plugin path
18 */ 18 */
19 function setUp() 19 public function setUp()
20 { 20 {
21 PluginManager::$PLUGINS_PATH = 'plugins'; 21 PluginManager::$PLUGINS_PATH = 'plugins';
22 } 22 }
@@ -25,7 +25,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
25 * Test render_linklist hook. 25 * Test render_linklist hook.
26 * Only check that there is basic markdown rendering. 26 * Only check that there is basic markdown rendering.
27 */ 27 */
28 function testMarkdownLinklist() 28 public function testMarkdownLinklist()
29 { 29 {
30 $markdown = '# My title' . PHP_EOL . 'Very interesting content.'; 30 $markdown = '# My title' . PHP_EOL . 'Very interesting content.';
31 $data = array( 31 $data = array(
@@ -45,7 +45,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
45 * Test render_daily hook. 45 * Test render_daily hook.
46 * Only check that there is basic markdown rendering. 46 * Only check that there is basic markdown rendering.
47 */ 47 */
48 function testMarkdownDaily() 48 public function testMarkdownDaily()
49 { 49 {
50 $markdown = '# My title' . PHP_EOL . 'Very interesting content.'; 50 $markdown = '# My title' . PHP_EOL . 'Very interesting content.';
51 $data = array( 51 $data = array(
@@ -69,7 +69,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
69 /** 69 /**
70 * Test reverse_text2clickable(). 70 * Test reverse_text2clickable().
71 */ 71 */
72 function testReverseText2clickable() 72 public function testReverseText2clickable()
73 { 73 {
74 $text = 'stuff http://hello.there/is=someone#here otherstuff'; 74 $text = 'stuff http://hello.there/is=someone#here otherstuff';
75 $clickableText = text2clickable($text, ''); 75 $clickableText = text2clickable($text, '');
@@ -80,7 +80,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
80 /** 80 /**
81 * Test reverse_nl2br(). 81 * Test reverse_nl2br().
82 */ 82 */
83 function testReverseNl2br() 83 public function testReverseNl2br()
84 { 84 {
85 $text = 'stuff' . PHP_EOL . 'otherstuff'; 85 $text = 'stuff' . PHP_EOL . 'otherstuff';
86 $processedText = nl2br($text); 86 $processedText = nl2br($text);
@@ -91,7 +91,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
91 /** 91 /**
92 * Test reverse_space2nbsp(). 92 * Test reverse_space2nbsp().
93 */ 93 */
94 function testReverseSpace2nbsp() 94 public function testReverseSpace2nbsp()
95 { 95 {
96 $text = ' stuff' . PHP_EOL . ' otherstuff and another'; 96 $text = ' stuff' . PHP_EOL . ' otherstuff and another';
97 $processedText = space2nbsp($text); 97 $processedText = space2nbsp($text);
@@ -102,7 +102,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
102 /** 102 /**
103 * Test sanitize_html(). 103 * Test sanitize_html().
104 */ 104 */
105 function testSanitizeHtml() 105 public function testSanitizeHtml()
106 { 106 {
107 $input = '< script src="js.js"/>'; 107 $input = '< script src="js.js"/>';
108 $input .= '< script attr>alert(\'xss\');</script>'; 108 $input .= '< script attr>alert(\'xss\');</script>';
@@ -119,7 +119,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
119 /** 119 /**
120 * Test the no markdown tag. 120 * Test the no markdown tag.
121 */ 121 */
122 function testNoMarkdownTag() 122 public function testNoMarkdownTag()
123 { 123 {
124 $str = 'All _work_ and `no play` makes Jack a *dull* boy.'; 124 $str = 'All _work_ and `no play` makes Jack a *dull* boy.';
125 $data = array( 125 $data = array(
@@ -158,7 +158,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
158 /** 158 /**
159 * Test that a close value to nomarkdown is not understand as nomarkdown (previous value `.nomarkdown`). 159 * Test that a close value to nomarkdown is not understand as nomarkdown (previous value `.nomarkdown`).
160 */ 160 */
161 function testNoMarkdownNotExcactlyMatching() 161 public function testNoMarkdownNotExcactlyMatching()
162 { 162 {
163 $str = 'All _work_ and `no play` makes Jack a *dull* boy.'; 163 $str = 'All _work_ and `no play` makes Jack a *dull* boy.';
164 $data = array( 164 $data = array(
@@ -176,7 +176,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
176 /** 176 /**
177 * Test hashtag links processed with markdown. 177 * Test hashtag links processed with markdown.
178 */ 178 */
179 function testMarkdownHashtagLinks() 179 public function testMarkdownHashtagLinks()
180 { 180 {
181 $md = file_get_contents('tests/plugins/resources/markdown.md'); 181 $md = file_get_contents('tests/plugins/resources/markdown.md');
182 $md = format_description($md); 182 $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
16 /** 16 /**
17 * Reset plugin path 17 * Reset plugin path
18 */ 18 */
19 function setUp() 19 public function setUp()
20 { 20 {
21 PluginManager::$PLUGINS_PATH = 'plugins'; 21 PluginManager::$PLUGINS_PATH = 'plugins';
22 } 22 }
@@ -24,7 +24,7 @@ class PluginPlayvideosTest extends PHPUnit_Framework_TestCase
24 /** 24 /**
25 * Test render_linklist hook. 25 * Test render_linklist hook.
26 */ 26 */
27 function testPlayvideosHeader() 27 public function testPlayvideosHeader()
28 { 28 {
29 $str = 'stuff'; 29 $str = 'stuff';
30 $data = array($str => $str); 30 $data = array($str => $str);
@@ -43,7 +43,7 @@ class PluginPlayvideosTest extends PHPUnit_Framework_TestCase
43 /** 43 /**
44 * Test render_footer hook. 44 * Test render_footer hook.
45 */ 45 */
46 function testPlayvideosFooter() 46 public function testPlayvideosFooter()
47 { 47 {
48 $str = 'stuff'; 48 $str = 'stuff';
49 $data = array($str => $str); 49 $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
17 /** 17 /**
18 * Reset plugin path 18 * Reset plugin path
19 */ 19 */
20 function setUp() 20 public function setUp()
21 { 21 {
22 PluginManager::$PLUGINS_PATH = 'plugins'; 22 PluginManager::$PLUGINS_PATH = 'plugins';
23 } 23 }
@@ -25,7 +25,7 @@ class PluginPubsubhubbubTest extends PHPUnit_Framework_TestCase
25 /** 25 /**
26 * Test render_feed hook with an RSS feed. 26 * Test render_feed hook with an RSS feed.
27 */ 27 */
28 function testPubSubRssRenderFeed() 28 public function testPubSubRssRenderFeed()
29 { 29 {
30 $hub = 'http://domain.hub'; 30 $hub = 'http://domain.hub';
31 $conf = new ConfigManager(self::$configFile); 31 $conf = new ConfigManager(self::$configFile);
@@ -40,7 +40,7 @@ class PluginPubsubhubbubTest extends PHPUnit_Framework_TestCase
40 /** 40 /**
41 * Test render_feed hook with an ATOM feed. 41 * Test render_feed hook with an ATOM feed.
42 */ 42 */
43 function testPubSubAtomRenderFeed() 43 public function testPubSubAtomRenderFeed()
44 { 44 {
45 $hub = 'http://domain.hub'; 45 $hub = 'http://domain.hub';
46 $conf = new ConfigManager(self::$configFile); 46 $conf = new ConfigManager(self::$configFile);
diff --git a/tests/plugins/PlugQrcodeTest.php b/tests/plugins/PluginQrcodeTest.php
index 86dc7f29..211ee89c 100644
--- a/tests/plugins/PlugQrcodeTest.php
+++ b/tests/plugins/PluginQrcodeTest.php
@@ -1,29 +1,29 @@
1<?php 1<?php
2 2
3/** 3/**
4 * PlugQrcodeTest.php 4 * PluginQrcodeTest.php
5 */ 5 */
6 6
7require_once 'plugins/qrcode/qrcode.php'; 7require_once 'plugins/qrcode/qrcode.php';
8require_once 'application/Router.php'; 8require_once 'application/Router.php';
9 9
10/** 10/**
11 * Class PlugQrcodeTest 11 * Class PluginQrcodeTest
12 * Unit test for the QR-Code plugin 12 * Unit test for the QR-Code plugin
13 */ 13 */
14class PlugQrcodeTest extends PHPUnit_Framework_TestCase 14class PluginQrcodeTest extends PHPUnit_Framework_TestCase
15{ 15{
16 /** 16 /**
17 * Reset plugin path 17 * Reset plugin path
18 */ 18 */
19 function setUp() { 19 public function setUp() {
20 PluginManager::$PLUGINS_PATH = 'plugins'; 20 PluginManager::$PLUGINS_PATH = 'plugins';
21 } 21 }
22 22
23 /** 23 /**
24 * Test render_linklist hook. 24 * Test render_linklist hook.
25 */ 25 */
26 function testQrcodeLinklist() 26 public function testQrcodeLinklist()
27 { 27 {
28 $str = 'http://randomstr.com/test'; 28 $str = 'http://randomstr.com/test';
29 $data = array( 29 $data = array(
@@ -49,7 +49,7 @@ class PlugQrcodeTest extends PHPUnit_Framework_TestCase
49 /** 49 /**
50 * Test render_footer hook. 50 * Test render_footer hook.
51 */ 51 */
52 function testQrcodeFooter() 52 public function testQrcodeFooter()
53 { 53 {
54 $str = 'stuff'; 54 $str = 'stuff';
55 $data = array($str => $str); 55 $data = array($str => $str);
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
15 /** 15 /**
16 * Reset plugin path 16 * Reset plugin path
17 */ 17 */
18 function setUp() 18 public function setUp()
19 { 19 {
20 PluginManager::$PLUGINS_PATH = 'plugins'; 20 PluginManager::$PLUGINS_PATH = 'plugins';
21 } 21 }
@@ -23,7 +23,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
23 /** 23 /**
24 * Test Readityourself init without errors. 24 * Test Readityourself init without errors.
25 */ 25 */
26 function testReadityourselfInitNoError() 26 public function testReadityourselfInitNoError()
27 { 27 {
28 $conf = new ConfigManager(''); 28 $conf = new ConfigManager('');
29 $conf->set('plugins.READITYOUSELF_URL', 'value'); 29 $conf->set('plugins.READITYOUSELF_URL', 'value');
@@ -34,7 +34,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
34 /** 34 /**
35 * Test Readityourself init with errors. 35 * Test Readityourself init with errors.
36 */ 36 */
37 function testReadityourselfInitError() 37 public function testReadityourselfInitError()
38 { 38 {
39 $conf = new ConfigManager(''); 39 $conf = new ConfigManager('');
40 $errors = readityourself_init($conf); 40 $errors = readityourself_init($conf);
@@ -44,7 +44,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
44 /** 44 /**
45 * Test render_linklist hook. 45 * Test render_linklist hook.
46 */ 46 */
47 function testReadityourselfLinklist() 47 public function testReadityourselfLinklist()
48 { 48 {
49 $conf = new ConfigManager(''); 49 $conf = new ConfigManager('');
50 $conf->set('plugins.READITYOUSELF_URL', 'value'); 50 $conf->set('plugins.READITYOUSELF_URL', 'value');
@@ -72,7 +72,7 @@ class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
72 /** 72 /**
73 * Test without config: nothing should happened. 73 * Test without config: nothing should happened.
74 */ 74 */
75 function testReadityourselfLinklistWithoutConfig() 75 public function testReadityourselfLinklistWithoutConfig()
76 { 76 {
77 $conf = new ConfigManager(''); 77 $conf = new ConfigManager('');
78 $conf->set('plugins.READITYOUSELF_URL', null); 78 $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
15 /** 15 /**
16 * Reset plugin path 16 * Reset plugin path
17 */ 17 */
18 function setUp() 18 public function setUp()
19 { 19 {
20 PluginManager::$PLUGINS_PATH = 'plugins'; 20 PluginManager::$PLUGINS_PATH = 'plugins';
21 } 21 }
@@ -23,7 +23,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase
23 /** 23 /**
24 * Test wallabag init without errors. 24 * Test wallabag init without errors.
25 */ 25 */
26 function testWallabagInitNoError() 26 public function testWallabagInitNoError()
27 { 27 {
28 $conf = new ConfigManager(''); 28 $conf = new ConfigManager('');
29 $conf->set('plugins.WALLABAG_URL', 'value'); 29 $conf->set('plugins.WALLABAG_URL', 'value');
@@ -34,7 +34,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase
34 /** 34 /**
35 * Test wallabag init with errors. 35 * Test wallabag init with errors.
36 */ 36 */
37 function testWallabagInitError() 37 public function testWallabagInitError()
38 { 38 {
39 $conf = new ConfigManager(''); 39 $conf = new ConfigManager('');
40 $errors = wallabag_init($conf); 40 $errors = wallabag_init($conf);
@@ -44,7 +44,7 @@ class PluginWallabagTest extends PHPUnit_Framework_TestCase
44 /** 44 /**
45 * Test render_linklist hook. 45 * Test render_linklist hook.
46 */ 46 */
47 function testWallabagLinklist() 47 public function testWallabagLinklist()
48 { 48 {
49 $conf = new ConfigManager(''); 49 $conf = new ConfigManager('');
50 $conf->set('plugins.WALLABAG_URL', 'value'); 50 $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
15 /** 15 /**
16 * Reset plugin path 16 * Reset plugin path
17 */ 17 */
18 function setUp() 18 public function setUp()
19 { 19 {
20 $this->instance = 'http://some.url'; 20 $this->instance = 'http://some.url';
21 } 21 }
@@ -23,7 +23,7 @@ class WallabagInstanceTest extends PHPUnit_Framework_TestCase
23 /** 23 /**
24 * Test WallabagInstance with API V1. 24 * Test WallabagInstance with API V1.
25 */ 25 */
26 function testWallabagInstanceV1() 26 public function testWallabagInstanceV1()
27 { 27 {
28 $instance = new WallabagInstance($this->instance, 1); 28 $instance = new WallabagInstance($this->instance, 1);
29 $expected = $this->instance . '/?plainurl='; 29 $expected = $this->instance . '/?plainurl=';
@@ -34,7 +34,7 @@ class WallabagInstanceTest extends PHPUnit_Framework_TestCase
34 /** 34 /**
35 * Test WallabagInstance with API V2. 35 * Test WallabagInstance with API V2.
36 */ 36 */
37 function testWallabagInstanceV2() 37 public function testWallabagInstanceV2()
38 { 38 {
39 $instance = new WallabagInstance($this->instance, 2); 39 $instance = new WallabagInstance($this->instance, 2);
40 $expected = $this->instance . '/bookmarklet?url='; 40 $expected = $this->instance . '/bookmarklet?url=';
@@ -45,7 +45,7 @@ class WallabagInstanceTest extends PHPUnit_Framework_TestCase
45 /** 45 /**
46 * Test WallabagInstance with an invalid API version. 46 * Test WallabagInstance with an invalid API version.
47 */ 47 */
48 function testWallabagInstanceInvalidVersion() 48 public function testWallabagInstanceInvalidVersion()
49 { 49 {
50 $instance = new WallabagInstance($this->instance, false); 50 $instance = new WallabagInstance($this->instance, false);
51 $expected = $this->instance . '/?plainurl='; 51 $expected = $this->instance . '/?plainurl=';