]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Merge pull request #732 from ArthurHoaro/feature/theme-manager
authorArthur <arthur@hoa.ro>
Fri, 6 Jan 2017 10:40:54 +0000 (11:40 +0100)
committerGitHub <noreply@github.com>
Fri, 6 Jan 2017 10:40:54 +0000 (11:40 +0100)
Theme manager: improvements

24 files changed:
application/Base64Url.php [new file with mode: 0644]
application/CachedPage.php
application/PageBuilder.php
application/api/ApiUtils.php
application/config/ConfigIO.php
application/config/ConfigJson.php
application/config/ConfigPhp.php
docker/development/nginx.conf
docker/production/nginx.conf
docker/production/stable/nginx.conf
index.php
plugins/wallabag/WallabagInstance.php
tests/Url/UrlTest.php
tests/api/ApiUtilsTest.php
tests/plugins/PluginAddlinkTest.php
tests/plugins/PluginArchiveorgTest.php
tests/plugins/PluginIssoTest.php
tests/plugins/PluginMarkdownTest.php
tests/plugins/PluginPlayvideosTest.php
tests/plugins/PluginPubsubhubbubTest.php
tests/plugins/PluginQrcodeTest.php [moved from tests/plugins/PlugQrcodeTest.php with 86% similarity]
tests/plugins/PluginReadityourselfTest.php
tests/plugins/PluginWallabagTest.php
tests/plugins/WallabagInstanceTest.php

diff --git a/application/Base64Url.php b/application/Base64Url.php
new file mode 100644 (file)
index 0000000..61590e4
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace Shaarli;
+
+
+/**
+ * URL-safe Base64 operations
+ *
+ * @see https://en.wikipedia.org/wiki/Base64#URL_applications
+ */
+class Base64Url
+{
+    /**
+     * Base64Url-encodes data
+     *
+     * @param string $data Data to encode
+     *
+     * @return string Base64Url-encoded data
+     */
+    public static function encode($data) {
+        return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
+    }
+
+    /**
+     * Decodes Base64Url-encoded data
+     *
+     * @param string $data Data to decode
+     *
+     * @return string Decoded data
+     */
+    public static function decode($data) {
+        return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
+    }
+}
index 5087d0c4b6b1fd6182fcd4564497d6531c78754b..e11cc52d01e3aeac07142c476d76e35bf7b88229 100644 (file)
@@ -7,9 +7,6 @@ class CachedPage
     // Directory containing page caches
     private $cacheDir;
 
-    // Full URL of the page to cache -typically the value returned by pageUrl()
-    private $url;
-
     // Should this URL be cached (boolean)?
     private $shouldBeCached;
 
@@ -27,7 +24,6 @@ class CachedPage
     {
         // TODO: check write access to the cache directory
         $this->cacheDir = $cacheDir;
-        $this->url = $url;
         $this->filename = $this->cacheDir.'/'.sha1($url).'.cache';
         $this->shouldBeCached = $shouldBeCached;
     }
index 32c7f9f18b01ba131be61bb778dc3d7a9239b727..544aba7ca3f3c1504a093a4f2483b29474af9268 100644 (file)
@@ -25,7 +25,7 @@ class PageBuilder
      *
      * @param ConfigManager $conf Configuration Manager instance (reference).
      */
-    function __construct(&$conf)
+    public function __construct(&$conf)
     {
         $this->tpl = false;
         $this->conf = $conf;
index fbb1e72f97dfc30c2da4451e96f51d055fea50e0..a419c39669a1a44bde14cb7baf8a3b3471041d50 100644 (file)
@@ -1,13 +1,11 @@
 <?php
-
 namespace Shaarli\Api;
 
+use Shaarli\Base64Url;
 use Shaarli\Api\Exceptions\ApiAuthorizationException;
 
 /**
- * Class ApiUtils
- *
- * Utility functions for the API.
+ * REST API utilities
  */
 class ApiUtils
 {
@@ -26,17 +24,17 @@ class ApiUtils
             throw new ApiAuthorizationException('Malformed JWT token');
         }
 
-        $genSign = hash_hmac('sha512', $parts[0] .'.'. $parts[1], $secret);
+        $genSign = Base64Url::encode(hash_hmac('sha512', $parts[0] .'.'. $parts[1], $secret, true));
         if ($parts[2] != $genSign) {
             throw new ApiAuthorizationException('Invalid JWT signature');
         }
 
-        $header = json_decode(base64_decode($parts[0]));
+        $header = json_decode(Base64Url::decode($parts[0]));
         if ($header === null) {
             throw new ApiAuthorizationException('Invalid JWT header');
         }
 
-        $payload = json_decode(base64_decode($parts[1]));
+        $payload = json_decode(Base64Url::decode($parts[1]));
         if ($payload === null) {
             throw new ApiAuthorizationException('Invalid JWT payload');
         }
index 2b68fe6ab7b4af924371bf7b1403a0f39d2f784f..be78b1c71cf52a798198cdfa44c9f5220b9bc9f8 100644 (file)
@@ -14,7 +14,7 @@ interface ConfigIO
      *
      * @return array All configuration in an array.
      */
-    function read($filepath);
+    public function read($filepath);
 
     /**
      * Write configuration.
@@ -22,12 +22,12 @@ interface ConfigIO
      * @param string $filepath Config file absolute path.
      * @param array  $conf   All configuration in an array.
      */
-    function write($filepath, $conf);
+    public function write($filepath, $conf);
 
     /**
      * Get config file extension according to config type.
      *
      * @return string Config file extension.
      */
-    function getExtension();
+    public function getExtension();
 }
index 30007eb4cfd550fc106d7ace97fca00545519cff..6b5d73f159440cc1276ff984d48ef0473c668859 100644 (file)
@@ -10,7 +10,7 @@ class ConfigJson implements ConfigIO
     /**
      * @inheritdoc
      */
-    function read($filepath)
+    public function read($filepath)
     {
         if (! is_readable($filepath)) {
             return array();
@@ -29,7 +29,7 @@ class ConfigJson implements ConfigIO
     /**
      * @inheritdoc
      */
-    function write($filepath, $conf)
+    public function write($filepath, $conf)
     {
         // JSON_PRETTY_PRINT is available from PHP 5.4.
         $print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
@@ -46,7 +46,7 @@ class ConfigJson implements ConfigIO
     /**
      * @inheritdoc
      */
-    function getExtension()
+    public function getExtension()
     {
         return '.json.php';
     }
index 2eb68d80a5b9d517a7f0eb36f112d0124df5b0e4..d7fd4baffa34d2fa3cec5bcb83f108c3571af97a 100644 (file)
@@ -72,7 +72,7 @@ class ConfigPhp implements ConfigIO
     /**
      * @inheritdoc
      */
-    function read($filepath)
+    public function read($filepath)
     {
         if (! file_exists($filepath) || ! is_readable($filepath)) {
             return array();
@@ -92,7 +92,7 @@ class ConfigPhp implements ConfigIO
     /**
      * @inheritdoc
      */
-    function write($filepath, $conf)
+    public function write($filepath, $conf)
     {
         $configStr = '<?php '. PHP_EOL;
         foreach (self::$ROOT_KEYS as $key) {
@@ -126,7 +126,7 @@ class ConfigPhp implements ConfigIO
     /**
      * @inheritdoc
      */
-    function getExtension()
+    public function getExtension()
     {
         return '.php';
     }
index ac0c6c61ce165976b7572bb96eb8ba90b5f4d2a8..79c45bfe9049dad77de492648260cb283a5859c7 100644 (file)
@@ -56,7 +56,16 @@ http {
             alias /var/www/shaarli/images/favicon.ico;
         }
 
+        location / {
+            # Slim - rewrite URLs
+            try_files $uri /index.php$is_args$args;
+        }
+
         location ~ (index)\.php$ {
+            # Slim - split URL path into (script_filename, path_info)
+            try_files $uri =404;
+            fastcgi_split_path_info ^(.+\.php)(/.+)$;
+
             # filter and proxy PHP requests to PHP-FPM
             fastcgi_pass   unix:/var/run/php5-fpm.sock;
             fastcgi_index  index.php;
index 5ffa02d0a9d570136d4ab7ea8f8bef4107f03cb7..e8754d9b478f85cbeb033756d2114759f1809d37 100644 (file)
@@ -48,7 +48,16 @@ http {
             alias /var/www/shaarli/images/favicon.ico;
         }
 
+        location / {
+            # Slim - rewrite URLs
+            try_files $uri /index.php$is_args$args;
+        }
+
         location ~ (index)\.php$ {
+            # Slim - split URL path into (script_filename, path_info)
+            try_files $uri =404;
+            fastcgi_split_path_info ^(.+\.php)(/.+)$;
+
             # filter and proxy PHP requests to PHP-FPM
             fastcgi_pass   unix:/var/run/php5-fpm.sock;
             fastcgi_index  index.php;
index 5ffa02d0a9d570136d4ab7ea8f8bef4107f03cb7..e8754d9b478f85cbeb033756d2114759f1809d37 100644 (file)
@@ -48,7 +48,16 @@ http {
             alias /var/www/shaarli/images/favicon.ico;
         }
 
+        location / {
+            # Slim - rewrite URLs
+            try_files $uri /index.php$is_args$args;
+        }
+
         location ~ (index)\.php$ {
+            # Slim - split URL path into (script_filename, path_info)
+            try_files $uri =404;
+            fastcgi_split_path_info ^(.+\.php)(/.+)$;
+
             # filter and proxy PHP requests to PHP-FPM
             fastcgi_pass   unix:/var/run/php5-fpm.sock;
             fastcgi_index  index.php;
index 14754269f38dbbf9df72651f96fd2f282c464040..e553d1ddcfd3564f3a8abdeeb575a9f428ee248b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -618,7 +618,7 @@ function showDailyRSS($conf) {
         $tpl->assign('links', $links);
         $tpl->assign('rssdate', escape($dayDate->format(DateTime::RSS)));
         $tpl->assign('hide_timestamps', $conf->get('privacy.hide_timestamps', false));
-        $html = $tpl->draw('dailyrss', $return_string=true);
+        $html = $tpl->draw('dailyrss', true);
 
         echo $html . PHP_EOL;
     }
index 72cc2e5efb56bc474233aaa95d6d94c14b10d7a3..eb8ab618f14f72a768b5851d4e804f1b5f0c2974 100644 (file)
@@ -35,7 +35,7 @@ class WallabagInstance
      */
     private $apiVersion;
 
-    function __construct($instance, $version)
+    public function __construct($instance, $version)
     {
         if ($this->isVersionAllowed($version)) {
             $this->apiVersion = self::$wallabagVersions[$version];
index 0586237211b7a402ea2a9a0f7c0b3749af6b516a..aa2f2234529b4878cdb3e926918a13d004f7d9bc 100644 (file)
@@ -157,7 +157,7 @@ class UrlTest extends PHPUnit_Framework_TestCase
     /**
      * Test add trailing slash.
      */
-    function testAddTrailingSlash()
+    public function testAddTrailingSlash()
     {
         $strOn = 'http://randomstr.com/test/';
         $strOff = 'http://randomstr.com/test';
@@ -168,7 +168,7 @@ class UrlTest extends PHPUnit_Framework_TestCase
     /**
      * Test valid HTTP url.
      */
-    function testUrlIsHttp()
+    public function testUrlIsHttp()
     {
         $url = new Url(self::$baseUrl);
         $this->assertTrue($url->isHttp());
@@ -177,7 +177,7 @@ class UrlTest extends PHPUnit_Framework_TestCase
     /**
      * Test non HTTP url.
      */
-    function testUrlIsNotHttp()
+    public function testUrlIsNotHttp()
     {
         $url = new Url('ftp://save.tld/mysave');
         $this->assertFalse($url->isHttp());
@@ -186,7 +186,7 @@ class UrlTest extends PHPUnit_Framework_TestCase
     /**
      * Test International Domain Name to ASCII conversion
      */
-    function testIdnToAscii()
+    public function testIdnToAscii()
     {
         $ind = 'http://www.académie-française.fr/';
         $expected = 'http://www.xn--acadmie-franaise-npb1a.fr/';
index 10da1459a1fbfee77f469ba251ea6036884d3c2d..4b2fa3b2719a289597adad2d42028f49e613c721 100644 (file)
@@ -2,6 +2,9 @@
 
 namespace Shaarli\Api;
 
+use Shaarli\Base64Url;
+
+
 /**
  * Class ApiUtilsTest
  */
@@ -24,14 +27,14 @@ class ApiUtilsTest extends \PHPUnit_Framework_TestCase
      */
     public static function generateValidJwtToken($secret)
     {
-        $header = base64_encode('{
+        $header = Base64Url::encode('{
             "typ": "JWT",
             "alg": "HS512"
         }');
-        $payload = base64_encode('{
+        $payload = Base64Url::encode('{
             "iat": '. time() .'
         }');
-        $signature = hash_hmac('sha512', $header .'.'. $payload , $secret);
+        $signature = Base64Url::encode(hash_hmac('sha512', $header .'.'. $payload , $secret, true));
         return $header .'.'. $payload .'.'. $signature;
     }
 
@@ -46,9 +49,9 @@ class ApiUtilsTest extends \PHPUnit_Framework_TestCase
      */
     public static function generateCustomJwtToken($header, $payload, $secret)
     {
-        $header = base64_encode($header);
-        $payload = base64_encode($payload);
-        $signature = hash_hmac('sha512', $header . '.' . $payload, $secret);
+        $header = Base64Url::encode($header);
+        $payload = Base64Url::encode($payload);
+        $signature = Base64Url::encode(hash_hmac('sha512', $header . '.' . $payload, $secret, true));
         return $header . '.' . $payload . '.' . $signature;
     }
 
index a2f25becbf4793a9657556151c55c908b7a18560..b77fe12a314bbb979b1cf806ef9c2c80ee126afd 100644 (file)
@@ -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);
index 4daa4c9d63deb491ca702cdadfa893f56f4122b4..fecd5f2c21488b3cf35390b663879766c0a1a0e8 100644 (file)
@@ -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);
-
     }
-    
 }
index 6b7904dd595fcbc09e64c5ec5c99fe66773b7cbc..03def208eea6c647356d2ca5db2c13906a1ff97d 100644 (file)
@@ -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('');
index 17ef228031331fba63fbb5ef567a3fc1fa06c04c..d359b2a164548f87ae282ec89c4b97ca84f8fbd7 100644 (file)
@@ -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\');</script>';
@@ -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);
index be1ef774796862ee2fbba32b6a7301365959254f..29ad047f4a10ae608dd1d1b59bd057f40429ff9a 100644 (file)
@@ -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);
index 24dd7a11b0d957da6bfcb39f9ecebfd86b3286de..1bd8793568c358127db6f5ff9b6a4313ba35e341 100644 (file)
@@ -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);
similarity index 86%
rename from tests/plugins/PlugQrcodeTest.php
rename to tests/plugins/PluginQrcodeTest.php
index 86dc7f293059a94830f0cbec3f0f7cc74229becc..211ee89c4a0755bb7ed66f360c474e3b120d14ad 100644 (file)
@@ -1,29 +1,29 @@
 <?php
 
 /**
- * PlugQrcodeTest.php
+ * PluginQrcodeTest.php
  */
 
 require_once 'plugins/qrcode/qrcode.php';
 require_once 'application/Router.php';
 
 /**
- * Class PlugQrcodeTest
+ * Class PluginQrcodeTest
  * Unit test for the QR-Code plugin
  */
-class PlugQrcodeTest extends PHPUnit_Framework_TestCase
+class PluginQrcodeTest extends PHPUnit_Framework_TestCase
 {
     /**
      * Reset plugin path
      */
-    function setUp() {
+    public function setUp() {
         PluginManager::$PLUGINS_PATH = 'plugins';
     }
 
     /**
      * Test render_linklist hook.
      */
-    function testQrcodeLinklist()
+    public function testQrcodeLinklist()
     {
         $str = 'http://randomstr.com/test';
         $data = array(
@@ -49,7 +49,7 @@ class PlugQrcodeTest extends PHPUnit_Framework_TestCase
     /**
      * Test render_footer hook.
      */
-    function testQrcodeFooter()
+    public function testQrcodeFooter()
     {
         $str = 'stuff';
         $data = array($str => $str);
index 532db14626d5e177566ddd8c352f5fab621f91a2..30470ab72fba4ee9dd6b48089a21fc642398ff3a 100644 (file)
@@ -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);
index 2c268cbd1b714b3b9aa1c29891bbf40e8592b24a..30351f4651dba8972c9533a66f2579ee87c0ce1c 100644 (file)
@@ -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');
index 7c14c1df0b8cb36dc897be9ad9b4f71776ab4a9a..2c46687100c13495408e80ac68dc31523283fd78 100644 (file)
@@ -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=';