From: VirtualTam Date: Fri, 12 Oct 2018 22:35:47 +0000 (+0200) Subject: lint: apply phpcbf to tests/ X-Git-Tag: v0.10.3~2^2~2^2~1 X-Git-Url: https://git.immae.eu/?p=github%2Fshaarli%2FShaarli.git;a=commitdiff_plain;h=067c2dd8f5f6eb6cc808ddc4bd30aec104caf73d lint: apply phpcbf to tests/ Signed-off-by: VirtualTam --- diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php index ff4c9e17..fe5f84ce 100644 --- a/tests/ApplicationUtilsTest.php +++ b/tests/ApplicationUtilsTest.php @@ -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 ) ); diff --git a/tests/CacheTest.php b/tests/CacheTest.php index 992e26a5..f60fad91 100644 --- a/tests/CacheTest.php +++ b/tests/CacheTest.php @@ -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); } diff --git a/tests/HttpUtils/GetIpAdressFromProxyTest.php b/tests/HttpUtils/GetIpAdressFromProxyTest.php index 6a74a45a..7af5bd9d 100644 --- a/tests/HttpUtils/GetIpAdressFromProxyTest.php +++ b/tests/HttpUtils/GetIpAdressFromProxyTest.php @@ -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 diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index fcab76f6..c763c0cb 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -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('://'))); } diff --git a/tests/LinkFilterTest.php b/tests/LinkFilterTest.php index 9cd6dbd4..250046f8 100644 --- a/tests/LinkFilterTest.php +++ b/tests/LinkFilterTest.php @@ -297,7 +297,7 @@ class LinkFilterTest extends PHPUnit_Framework_TestCase $this->assertEquals( 3, count(self::$linkFilter->filter(LinkFilter::$FILTER_TEXT, '"free software"')) - ); + ); } /** diff --git a/tests/LinkUtilsTest.php b/tests/LinkUtilsTest.php index 7fbd59b0..ca062f05 100644 --- a/tests/LinkUtilsTest.php +++ b/tests/LinkUtilsTest.php @@ -410,4 +410,3 @@ function ut_curl_getinfo_rs_ct_ko($ch, $type) return 'text/plain'; } } - diff --git a/tests/RouterTest.php b/tests/RouterTest.php index 544bcf9c..abf1bd5f 100644 --- a/tests/RouterTest.php +++ b/tests/RouterTest.php @@ -218,7 +218,6 @@ class RouterTest extends PHPUnit_Framework_TestCase Router::$PAGE_CHANGEPASSWORD, Router::findPage('do=changepasswd&stuff', array(), true) ); - } /** diff --git a/tests/ThumbnailerTest.php b/tests/ThumbnailerTest.php index 08311545..c01849f7 100644 --- a/tests/ThumbnailerTest.php +++ b/tests/ThumbnailerTest.php @@ -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); + } } } } diff --git a/tests/Updater/DummyUpdater.php b/tests/Updater/DummyUpdater.php index a0be4413..a805ab5e 100644 --- a/tests/Updater/DummyUpdater.php +++ b/tests/Updater/DummyUpdater.php @@ -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'); } diff --git a/tests/Url/CleanupUrlTest.php b/tests/Url/CleanupUrlTest.php index 1407d7d2..24791948 100644 --- a/tests/Url/CleanupUrlTest.php +++ b/tests/Url/CleanupUrlTest.php @@ -107,4 +107,3 @@ class CleanupUrlTest extends PHPUnit_Framework_TestCase ); } } - diff --git a/tests/Url/GetUrlSchemeTest.php b/tests/Url/GetUrlSchemeTest.php index 72d80b30..18b932d6 100644 --- a/tests/Url/GetUrlSchemeTest.php +++ b/tests/Url/GetUrlSchemeTest.php @@ -28,4 +28,3 @@ class GetUrlSchemeTest extends PHPUnit_Framework_TestCase $this->assertEquals('git', get_url_scheme('git://domain.tld/push?pull=clone#checkout')); } } - diff --git a/tests/Url/UnparseUrlTest.php b/tests/Url/UnparseUrlTest.php index edde73e4..e314b484 100644 --- a/tests/Url/UnparseUrlTest.php +++ b/tests/Url/UnparseUrlTest.php @@ -28,4 +28,3 @@ class UnparseUrlTest extends PHPUnit_Framework_TestCase $this->assertEquals($ref, unparse_url(parse_url($ref))); } } - diff --git a/tests/Url/UrlTest.php b/tests/Url/UrlTest.php index aa2f2234..db229ce0 100644 --- a/tests/Url/UrlTest.php +++ b/tests/Url/UrlTest.php @@ -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'); diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index 6cd37a7a..d0abd996 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -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')); } diff --git a/tests/api/ApiUtilsTest.php b/tests/api/ApiUtilsTest.php index 62baf4c5..df4e189a 100644 --- a/tests/api/ApiUtilsTest.php +++ b/tests/api/ApiUtilsTest.php @@ -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; } diff --git a/tests/api/controllers/history/HistoryTest.php b/tests/api/controllers/history/HistoryTest.php index 61046d97..ff34e16d 100644 --- a/tests/api/controllers/history/HistoryTest.php +++ b/tests/api/controllers/history/HistoryTest.php @@ -3,7 +3,6 @@ namespace Shaarli\Api\Controllers; - use Shaarli\Config\ConfigManager; use Slim\Container; use Slim\Http\Environment; diff --git a/tests/api/controllers/info/InfoTest.php b/tests/api/controllers/info/InfoTest.php index f7e63bfa..e437082a 100644 --- a/tests/api/controllers/info/InfoTest.php +++ b/tests/api/controllers/info/InfoTest.php @@ -10,9 +10,9 @@ use Slim\Http\Response; /** * Class InfoTest - * + * * Test REST API controller Info. - * + * * @package Api\Controllers */ class InfoTest extends \PHPUnit_Framework_TestCase diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php index 100a9170..37617611 100644 --- a/tests/api/controllers/links/PostLinkTest.php +++ b/tests/api/controllers/links/PostLinkTest.php @@ -2,7 +2,6 @@ namespace Shaarli\Api\Controllers; - use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use Slim\Container; diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php index 8a562571..72b895f2 100644 --- a/tests/api/controllers/links/PutLinkTest.php +++ b/tests/api/controllers/links/PutLinkTest.php @@ -3,7 +3,6 @@ namespace Shaarli\Api\Controllers; - use Shaarli\Config\ConfigManager; use Slim\Container; use Slim\Http\Environment; diff --git a/tests/api/controllers/tags/PutTagTest.php b/tests/api/controllers/tags/PutTagTest.php index 6f7dec22..38017243 100644 --- a/tests/api/controllers/tags/PutTagTest.php +++ b/tests/api/controllers/tags/PutTagTest.php @@ -3,7 +3,6 @@ namespace Shaarli\Api\Controllers; - use Shaarli\Api\Exceptions\ApiBadParametersException; use Shaarli\Config\ConfigManager; use Slim\Container; diff --git a/tests/languages/de/UtilsDeTest.php b/tests/languages/de/UtilsDeTest.php index 4569c923..588c9fd6 100644 --- a/tests/languages/de/UtilsDeTest.php +++ b/tests/languages/de/UtilsDeTest.php @@ -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)); } /** diff --git a/tests/languages/fr/LanguagesFrTest.php b/tests/languages/fr/LanguagesFrTest.php index 0cf74891..38347de1 100644 --- a/tests/languages/fr/LanguagesFrTest.php +++ b/tests/languages/fr/LanguagesFrTest.php @@ -3,7 +3,6 @@ namespace Shaarli; - use Shaarli\Config\ConfigManager; /** diff --git a/tests/plugins/PluginQrcodeTest.php b/tests/plugins/PluginQrcodeTest.php index ebfadddf..dd632eee 100644 --- a/tests/plugins/PluginQrcodeTest.php +++ b/tests/plugins/PluginQrcodeTest.php @@ -15,7 +15,8 @@ class PluginQrcodeTest extends PHPUnit_Framework_TestCase /** * Reset plugin path */ - public function setUp() { + public function setUp() + { PluginManager::$PLUGINS_PATH = 'plugins'; } diff --git a/tests/security/SessionManagerTest.php b/tests/security/SessionManagerTest.php index 9bd868f8..7961e771 100644 --- a/tests/security/SessionManagerTest.php +++ b/tests/security/SessionManagerTest.php @@ -8,7 +8,6 @@ ReferenceSessionIdHashes::genAllHashes(); use \Shaarli\Security\SessionManager; use \PHPUnit\Framework\TestCase; - /** * Test coverage for SessionManager */ diff --git a/tests/utils/ReferenceLinkDB.php b/tests/utils/ReferenceLinkDB.php index 7426ad07..59679e38 100644 --- a/tests/utils/ReferenceLinkDB.php +++ b/tests/utils/ReferenceLinkDB.php @@ -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; } diff --git a/tests/utils/config/configPhp.php b/tests/utils/config/configPhp.php index 0e034175..34b11fcd 100644 --- a/tests/utils/config/configPhp.php +++ b/tests/utils/config/configPhp.php @@ -1,4 +1,4 @@ -