lint: apply phpcbf to tests/
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
parent
93bf0918fa
commit
067c2dd8f5
26 changed files with 38 additions and 43 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
/**
|
||||
* Unitary tests for getIpAddressFromProxy()
|
||||
*/
|
||||
class GetIpAdressFromProxyTest extends PHPUnit_Framework_TestCase {
|
||||
class GetIpAdressFromProxyTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Test without proxy
|
||||
|
|
|
@ -362,7 +362,7 @@ public function testAllTags()
|
|||
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 @@ public function testLinkRealUrlWithRedirector()
|
|||
{
|
||||
$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('://')));
|
||||
}
|
||||
|
|
|
@ -410,4 +410,3 @@ function ut_curl_getinfo_rs_ct_ko($ch, $type)
|
|||
return 'text/plain';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -218,7 +218,6 @@ public function testFindPageChangepasswdValid()
|
|||
Router::$PAGE_CHANGEPASSWORD,
|
||||
Router::findPage('do=changepasswd&stuff', array(), true)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -98,17 +98,19 @@ public function testThumbnailNotValid()
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public function __construct($doneUpdates, $linkDB, $conf, $isLoggedIn)
|
|||
*
|
||||
* @return bool true.
|
||||
*/
|
||||
private final function updateMethodDummy1()
|
||||
final private function updateMethodDummy1()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ private final function updateMethodDummy1()
|
|||
*
|
||||
* @return bool true.
|
||||
*/
|
||||
private final function updateMethodDummy2()
|
||||
final private function updateMethodDummy2()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ private final function updateMethodDummy2()
|
|||
*
|
||||
* @return bool true.
|
||||
*/
|
||||
private final function updateMethodDummy3()
|
||||
final private function updateMethodDummy3()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ private final function updateMethodDummy3()
|
|||
*
|
||||
* @throws Exception error.
|
||||
*/
|
||||
private final function updateMethodException()
|
||||
final private function updateMethodException()
|
||||
{
|
||||
throw new Exception('whatever');
|
||||
}
|
||||
|
|
|
@ -107,4 +107,3 @@ public function testCleanupUrlQueryFragment()
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,4 +28,3 @@ public function testGetUrlScheme()
|
|||
$this->assertEquals('git', get_url_scheme('git://domain.tld/push?pull=clone#checkout'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,4 +28,3 @@ public function testUnparseFull()
|
|||
$this->assertEquals($ref, unparse_url(parse_url($ref)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 @@ public function testCleanupMixedContent()
|
|||
'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');
|
||||
|
|
|
@ -187,7 +187,8 @@ public function testCheckInvalidDateFormat()
|
|||
/**
|
||||
* 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 @@ public function testGenerateLocation() {
|
|||
/**
|
||||
* 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 @@ public function testGenerateLocationLoop() {
|
|||
/**
|
||||
* Test generate location - from other domain.
|
||||
*/
|
||||
public function testGenerateLocationOut() {
|
||||
public function testGenerateLocationOut()
|
||||
{
|
||||
$ref = 'http://somewebsite.com/?test';
|
||||
$this->assertEquals('?', generateLocation($ref, 'localhost'));
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
use Shaarli\Base64Url;
|
||||
|
||||
|
||||
/**
|
||||
* Class ApiUtilsTest
|
||||
*/
|
||||
|
@ -34,7 +33,7 @@ public static function generateValidJwtToken($secret)
|
|||
$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;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
namespace Shaarli\Api\Controllers;
|
||||
|
||||
|
||||
use Shaarli\Config\ConfigManager;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Shaarli\Api\Controllers;
|
||||
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shaarli\Config\ConfigManager;
|
||||
use Slim\Container;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
namespace Shaarli\Api\Controllers;
|
||||
|
||||
|
||||
use Shaarli\Config\ConfigManager;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
namespace Shaarli\Api\Controllers;
|
||||
|
||||
|
||||
use Shaarli\Api\Exceptions\ApiBadParametersException;
|
||||
use Shaarli\Config\ConfigManager;
|
||||
use Slim\Container;
|
||||
|
|
|
@ -20,7 +20,7 @@ public function testDateFormat()
|
|||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
namespace Shaarli;
|
||||
|
||||
|
||||
use Shaarli\Config\ConfigManager;
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,7 +15,8 @@ class PluginQrcodeTest extends PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* Reset plugin path
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp()
|
||||
{
|
||||
PluginManager::$PLUGINS_PATH = 'plugins';
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
use \Shaarli\Security\SessionManager;
|
||||
use \PHPUnit\Framework\TestCase;
|
||||
|
||||
|
||||
/**
|
||||
* Test coverage for SessionManager
|
||||
*/
|
||||
|
|
|
@ -150,8 +150,8 @@ protected function addLink(
|
|||
$tags,
|
||||
$updated = '',
|
||||
$shorturl = '',
|
||||
$pinned = false)
|
||||
{
|
||||
$pinned = false
|
||||
) {
|
||||
$link = array(
|
||||
'id' => $id,
|
||||
'title' => $title,
|
||||
|
@ -201,7 +201,7 @@ public function reorder($order = 'DESC')
|
|||
|
||||
$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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue