]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
lint: apply phpcbf to tests/
authorVirtualTam <virtualtam@flibidi.net>
Fri, 12 Oct 2018 22:35:47 +0000 (00:35 +0200)
committerVirtualTam <virtualtam@flibidi.net>
Sun, 2 Dec 2018 21:39:16 +0000 (22:39 +0100)
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
26 files changed:
tests/ApplicationUtilsTest.php
tests/CacheTest.php
tests/HttpUtils/GetIpAdressFromProxyTest.php
tests/LinkDBTest.php
tests/LinkFilterTest.php
tests/LinkUtilsTest.php
tests/RouterTest.php
tests/ThumbnailerTest.php
tests/Updater/DummyUpdater.php
tests/Url/CleanupUrlTest.php
tests/Url/GetUrlSchemeTest.php
tests/Url/UnparseUrlTest.php
tests/Url/UrlTest.php
tests/UtilsTest.php
tests/api/ApiUtilsTest.php
tests/api/controllers/history/HistoryTest.php
tests/api/controllers/info/InfoTest.php
tests/api/controllers/links/PostLinkTest.php
tests/api/controllers/links/PutLinkTest.php
tests/api/controllers/tags/PutTagTest.php
tests/languages/de/UtilsDeTest.php
tests/languages/fr/LanguagesFrTest.php
tests/plugins/PluginQrcodeTest.php
tests/security/SessionManagerTest.php
tests/utils/ReferenceLinkDB.php
tests/utils/config/configPhp.php

index ff4c9e17944be6de5fa9e53f9574eb1baac5c665..fe5f84ce674f8dadcf195793b0ec61c0d807891b 100644 (file)
@@ -17,7 +17,7 @@ class FakeApplicationUtils extends ApplicationUtils
     /**
      * Toggle HTTP requests, allow overriding the version code
      */
-    public static function getVersion($url, $timeout=0)
+    public static function getVersion($url, $timeout = 0)
     {
         return self::$VERSION_CODE;
     }
@@ -67,7 +67,7 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase
             '0.5.4',
             ApplicationUtils::getVersion(
                 'https://raw.githubusercontent.com/shaarli/Shaarli/'
-               .'v0.5.4/shaarli_version.php',
+                .'v0.5.4/shaarli_version.php',
                 $testTimeout
             )
         );
@@ -75,7 +75,7 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase
             self::$versionPattern,
             ApplicationUtils::getVersion(
                 'https://raw.githubusercontent.com/shaarli/Shaarli/'
-               .'latest/shaarli_version.php',
+                .'latest/shaarli_version.php',
                 $testTimeout
             )
         );
index 992e26a5502cea6afc15cc9756f85c7e507089d0..f60fad91099048ba5d1c8c2d3d34289175880a4f 100644 (file)
@@ -84,7 +84,7 @@ class CacheTest extends PHPUnit_Framework_TestCase
         invalidateCaches(self::$testCacheDir);
         foreach (self::$pages as $page) {
             $this->assertFileNotExists(self::$testCacheDir.'/'.$page.'.cache');
-        }        
+        }
 
         $this->assertArrayNotHasKey('tags', $_SESSION);
     }
index 6a74a45aff696f66623d64b3072c0c0af62a2272..7af5bd9db058c356e9b0b13a52cc2ffc430b2337 100644 (file)
@@ -5,7 +5,8 @@ require_once 'application/HttpUtils.php';
 /**
  * Unitary tests for getIpAddressFromProxy()
  */
-class GetIpAdressFromProxyTest extends PHPUnit_Framework_TestCase {
+class GetIpAdressFromProxyTest extends PHPUnit_Framework_TestCase
+{
 
     /**
      * Test without proxy
index fcab76f609b8366a1f2d657fc1aaa76ab0386519..c763c0cbd5f34ce7797658b7bcae2e72829f3290 100644 (file)
@@ -362,7 +362,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
     public function testLinkRealUrlWithoutRedirector()
     {
         $db = new LinkDB(self::$testDatastore, false, false);
-        foreach($db as $link) {
+        foreach ($db as $link) {
             $this->assertEquals($link['url'], $link['real_url']);
         }
     }
@@ -374,13 +374,13 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
     {
         $redirector = 'http://redirector.to?';
         $db = new LinkDB(self::$testDatastore, false, false, $redirector);
-        foreach($db as $link) {
+        foreach ($db as $link) {
             $this->assertStringStartsWith($redirector, $link['real_url']);
             $this->assertNotFalse(strpos($link['real_url'], urlencode('://')));
         }
 
         $db = new LinkDB(self::$testDatastore, false, false, $redirector, false);
-        foreach($db as $link) {
+        foreach ($db as $link) {
             $this->assertStringStartsWith($redirector, $link['real_url']);
             $this->assertFalse(strpos($link['real_url'], urlencode('://')));
         }
index 9cd6dbd443b2a52b492cd165d12155c06aa14f49..250046f84d0273b66e3d9b5a11b9d5b35f06979e 100644 (file)
@@ -297,7 +297,7 @@ class LinkFilterTest extends PHPUnit_Framework_TestCase
         $this->assertEquals(
             3,
             count(self::$linkFilter->filter(LinkFilter::$FILTER_TEXT, '"free software"'))
-        );        
+        );
     }
 
     /**
index 7fbd59b0b80489d7b9e3521664e8aeb7d204b19d..ca062f053aa4224f3f83d4b279a4f3b1d35199ee 100644 (file)
@@ -410,4 +410,3 @@ function ut_curl_getinfo_rs_ct_ko($ch, $type)
             return 'text/plain';
     }
 }
-
index 544bcf9c8890d6613f569795df1456107cee8b99..abf1bd5f5067caf74451439273c2e5a494fe4963 100644 (file)
@@ -218,7 +218,6 @@ class RouterTest extends PHPUnit_Framework_TestCase
             Router::$PAGE_CHANGEPASSWORD,
             Router::findPage('do=changepasswd&stuff', array(), true)
         );
-
     }
 
     /**
index 08311545ef3b597f19d124aa7e6dc7286b69ae1d..c01849f7f089e45e1ca17af6dcb0ee0a3c2e5daf 100644 (file)
@@ -98,15 +98,17 @@ class ThumbnailerTest extends TestCase
         ini_set('error_log', $oldlog);
     }
 
-    protected function rrmdirContent($dir) {
+    protected function rrmdirContent($dir)
+    {
         if (is_dir($dir)) {
             $objects = scandir($dir);
             foreach ($objects as $object) {
                 if ($object != "." && $object != "..") {
-                    if (is_dir($dir."/".$object))
+                    if (is_dir($dir."/".$object)) {
                         $this->rrmdirContent($dir."/".$object);
-                    else
+                    } else {
                         unlink($dir."/".$object);
+                    }
                 }
             }
         }
index a0be4413e1e2e8f39c8e55eec78e6bddd49f3aa1..a805ab5e900181755191e46b2dbe82b2f3c9e2dd 100644 (file)
@@ -31,7 +31,7 @@ class DummyUpdater extends Updater
      *
      * @return bool true.
      */
-    private final function updateMethodDummy1()
+    final private function updateMethodDummy1()
     {
         return true;
     }
@@ -41,7 +41,7 @@ class DummyUpdater extends Updater
      *
      * @return bool true.
      */
-    private final function updateMethodDummy2()
+    final private function updateMethodDummy2()
     {
         return true;
     }
@@ -51,7 +51,7 @@ class DummyUpdater extends Updater
      *
      * @return bool true.
      */
-    private final function updateMethodDummy3()
+    final private function updateMethodDummy3()
     {
         return true;
     }
@@ -61,7 +61,7 @@ class DummyUpdater extends Updater
      *
      * @throws Exception error.
      */
-    private final function updateMethodException()
+    final private function updateMethodException()
     {
         throw new Exception('whatever');
     }
index 1407d7d2581689bddaba990c5435ec9506781db3..24791948337a94be0692a6e97b4c20faa94d2de2 100644 (file)
@@ -107,4 +107,3 @@ class CleanupUrlTest extends PHPUnit_Framework_TestCase
         );
     }
 }
-
index 72d80b30825ee452a1028e4b962ee0c477229160..18b932d6f3a350c9f7191a5faf7517ffbdd02b76 100644 (file)
@@ -28,4 +28,3 @@ class GetUrlSchemeTest extends PHPUnit_Framework_TestCase
         $this->assertEquals('git', get_url_scheme('git://domain.tld/push?pull=clone#checkout'));
     }
 }
-
index edde73e408580fe0f7e40884645b2bdf302d9b15..e314b48468b789688fec09dda194074c670de0e3 100644 (file)
@@ -28,4 +28,3 @@ class UnparseUrlTest extends PHPUnit_Framework_TestCase
         $this->assertEquals($ref, unparse_url(parse_url($ref)));
     }
 }
-
index aa2f2234529b4878cdb3e926918a13d004f7d9bc..db229ce0d87c544ff912fd5240cc6a15dccaa950 100644 (file)
@@ -16,7 +16,7 @@ class UrlTest extends PHPUnit_Framework_TestCase
     /**
      * Helper method
      */
-    private function assertUrlIsCleaned($query='', $fragment='')
+    private function assertUrlIsCleaned($query = '', $fragment = '')
     {
         $url = new Url(self::$baseUrl.$query.$fragment);
         $url->cleanup();
@@ -135,13 +135,13 @@ class UrlTest extends PHPUnit_Framework_TestCase
             'about://reader?url=' . urlencode(self::$baseUrl .'?my=stuff&is=kept')
         );
         $this->assertEquals(self::$baseUrl.'?my=stuff&is=kept', $url->cleanup());
-
     }
 
     /**
      * Test default http scheme.
      */
-    public function testDefaultScheme() {
+    public function testDefaultScheme()
+    {
         $url = new Url(self::$baseUrl);
         $this->assertEquals('http', $url->getScheme());
         $url = new Url('domain.tld');
index 6cd37a7afa27836249af244559fe23c93748e2bd..d0abd9968cfdc4afa152db87682b00ae4d5d73e5 100644 (file)
@@ -187,7 +187,8 @@ class UtilsTest extends PHPUnit_Framework_TestCase
     /**
      * Test generate location with valid data.
      */
-    public function testGenerateLocation() {
+    public function testGenerateLocation()
+    {
         $ref = 'http://localhost/?test';
         $this->assertEquals($ref, generateLocation($ref, 'localhost'));
         $ref = 'http://localhost:8080/?test';
@@ -199,7 +200,8 @@ class UtilsTest extends PHPUnit_Framework_TestCase
     /**
      * Test generate location - anti loop.
      */
-    public function testGenerateLocationLoop() {
+    public function testGenerateLocationLoop()
+    {
         $ref = 'http://localhost/?test';
         $this->assertEquals('?', generateLocation($ref, 'localhost', array('test')));
     }
@@ -207,7 +209,8 @@ class UtilsTest extends PHPUnit_Framework_TestCase
     /**
      * Test generate location - from other domain.
      */
-    public function testGenerateLocationOut() {
+    public function testGenerateLocationOut()
+    {
         $ref = 'http://somewebsite.com/?test';
         $this->assertEquals('?', generateLocation($ref, 'localhost'));
     }
index 62baf4c52f606d9dd8918ac821cec6dbbc73a989..df4e189a9f786b91718cde89b6152c90bac395c0 100644 (file)
@@ -4,7 +4,6 @@ namespace Shaarli\Api;
 
 use Shaarli\Base64Url;
 
-
 /**
  * Class ApiUtilsTest
  */
@@ -34,7 +33,7 @@ class ApiUtilsTest extends \PHPUnit_Framework_TestCase
         $payload = Base64Url::encode('{
             "iat": '. time() .'
         }');
-        $signature = Base64Url::encode(hash_hmac('sha512', $header .'.'. $payload , $secret, true));
+        $signature = Base64Url::encode(hash_hmac('sha512', $header .'.'. $payload, $secret, true));
         return $header .'.'. $payload .'.'. $signature;
     }
 
index 61046d9732e78439c10aa028c7ddb3720583d9aa..ff34e16dce598be8e849fba6fac30887908cc875 100644 (file)
@@ -3,7 +3,6 @@
 
 namespace Shaarli\Api\Controllers;
 
-
 use Shaarli\Config\ConfigManager;
 use Slim\Container;
 use Slim\Http\Environment;
index f7e63bfaf2623e498ce0f9605c76aad7e517975b..e437082a1af9517b9b658498a07bed89ff9459c8 100644 (file)
@@ -10,9 +10,9 @@ use Slim\Http\Response;
 
 /**
  * Class InfoTest
- * 
+ *
  * Test REST API controller Info.
- * 
+ *
  * @package Api\Controllers
  */
 class InfoTest extends \PHPUnit_Framework_TestCase
index 100a91704f866e383430cf2e690522302ba20957..376176113c2ddba858caceb7b9138ef940c5e64b 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace Shaarli\Api\Controllers;
 
-
 use PHPUnit\Framework\TestCase;
 use Shaarli\Config\ConfigManager;
 use Slim\Container;
index 8a5625710b5e924cda9d3c5146112b3d3851f353..72b895f22ad470c8e1857ffb65e4d14e63549915 100644 (file)
@@ -3,7 +3,6 @@
 
 namespace Shaarli\Api\Controllers;
 
-
 use Shaarli\Config\ConfigManager;
 use Slim\Container;
 use Slim\Http\Environment;
index 6f7dec224071c7c764506a52e4b1e2680ad33cef..3801724304d9b011c88325ff60d77fc8e0cf826f 100644 (file)
@@ -3,7 +3,6 @@
 
 namespace Shaarli\Api\Controllers;
 
-
 use Shaarli\Api\Exceptions\ApiBadParametersException;
 use Shaarli\Config\ConfigManager;
 use Slim\Container;
index 4569c923b3171609d8a755cd32aa4cdf06c755a2..588c9fd6e4749e59517bbbedd248c04698331616 100644 (file)
@@ -20,7 +20,7 @@ class UtilsDeTest extends UtilsTest
     public function testDateFormatNoTime()
     {
         $date = DateTime::createFromFormat('Ymd_His', '20170101_101112');
-        $this->assertRegExp('/1\. Januar 2017/', format_date($date, false,true));
+        $this->assertRegExp('/1\. Januar 2017/', format_date($date, false, true));
     }
 
     /**
index 0cf74891b7ab937403c2b6f6184975edeb5a2671..38347de19cce5e543e8774d60b5991a19c6bc8ed 100644 (file)
@@ -3,7 +3,6 @@
 
 namespace Shaarli;
 
-
 use Shaarli\Config\ConfigManager;
 
 /**
index ebfadddf39b0bd6241b13273d8734d633c74cebe..dd632eee4594592a5ebcadf47b6c386caffe7a49 100644 (file)
@@ -15,7 +15,8 @@ class PluginQrcodeTest extends PHPUnit_Framework_TestCase
     /**
      * Reset plugin path
      */
-    public function setUp() {
+    public function setUp()
+    {
         PluginManager::$PLUGINS_PATH = 'plugins';
     }
 
index 9bd868f809687273bf680f8a551ac41d876d8684..7961e7710dc3581a2d7f63659fc6f2aa500c25b2 100644 (file)
@@ -8,7 +8,6 @@ ReferenceSessionIdHashes::genAllHashes();
 use \Shaarli\Security\SessionManager;
 use \PHPUnit\Framework\TestCase;
 
-
 /**
  * Test coverage for SessionManager
  */
index 7426ad0783e49652872f4b9ca2db8e5951f5c21b..59679e380f8d59b8e959d5773b941ec9b68b3a65 100644 (file)
@@ -150,8 +150,8 @@ class ReferenceLinkDB
         $tags,
         $updated = '',
         $shorturl = '',
-        $pinned = false)
-    {
+        $pinned = false
+    {
         $link = array(
             'id' => $id,
             'title' => $title,
@@ -201,7 +201,7 @@ class ReferenceLinkDB
 
         $order = $order === 'ASC' ? -1 : 1;
         // Reorder array by dates.
-        usort($this->_links, function($a, $b) use ($order) {
+        usort($this->_links, function ($a, $b) use ($order) {
             if (isset($a['sticky']) && isset($b['sticky']) && $a['sticky'] !== $b['sticky']) {
                 return $a['sticky'] ? -1 : 1;
             }
index 0e034175757d7ccc1f076606d70b181bc05b8f88..34b11fcddf1a76ed9a1ef3f926e999ce9ab70cd8 100644 (file)
@@ -1,4 +1,4 @@
-<?php 
+<?php
 $GLOBALS['login'] = 'root';
 $GLOBALS['hash'] = 'hash';
 $GLOBALS['salt'] = 'salt';