Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaurício Meneghini Fauth <mauriciofauth@gmail.com>2018-05-18 07:59:38 +0300
committerMaurício Meneghini Fauth <mauriciofauth@gmail.com>2018-05-18 07:59:38 +0300
commitbaf0985e5ff107aeed05b56e3b99315b2faa03e2 (patch)
treebb118f90b475face2ab8e5556780428f778274b3 /test
parent01910f5474c324e925c6e7b026dabcecc74ce78c (diff)
Fix phpcs errors
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/EnvironmentTest.php (renamed from test/Environment_test.php)8
-rw-r--r--test/classes/AdvisorTest.php6
-rw-r--r--test/classes/CharsetsTest.php3
-rw-r--r--test/classes/Config/DescriptionTest.php15
-rw-r--r--test/classes/Config/Forms/FormListTest.php8
-rw-r--r--test/classes/Config/ServerConfigChecksTest.php18
-rw-r--r--test/classes/ConfigTest.php17
-rw-r--r--test/classes/Controllers/Table/TableRelationControllerTest.php44
-rw-r--r--test/classes/Database/SearchTest.php7
-rw-r--r--test/classes/DatabaseInterfaceTest.php33
-rw-r--r--test/classes/EncodingTest.php24
-rw-r--r--test/classes/ErrorTest.php4
-rw-r--r--test/classes/FontTest.php2
-rw-r--r--test/classes/IpAllowDenyTest.php5
-rw-r--r--test/classes/LanguageTest.php6
-rw-r--r--test/classes/Plugins/Auth/AuthenticationCookieTest.php41
-rw-r--r--test/classes/Plugins/Auth/AuthenticationHttpTest.php17
-rw-r--r--test/classes/PmaTestCase.php8
-rw-r--r--test/classes/SanitizeTest.php12
-rw-r--r--test/classes/TableTest.php52
-rw-r--r--test/classes/TransformationsTest.php8
-rw-r--r--test/classes/TwoFactorTest.php27
-rw-r--r--test/classes/UtilTest.php6
-rw-r--r--test/classes/Utils/HttpRequestTest.php41
-rw-r--r--test/classes/ZipExtensionTest.php8
-rw-r--r--test/libraries/DummyDbiTest.php (renamed from test/libraries/database_interface_test.php)6
-rw-r--r--test/libraries/FilesTest.php (renamed from test/libraries/Files_test.php)17
-rw-r--r--test/libraries/common/GetCheckboxTest.php (renamed from test/libraries/common/PMA_checkbox_test.php)4
-rw-r--r--test/selenium/CreateDropDatabaseTest.php3
-rw-r--r--test/selenium/CreateRemoveUserTest.php3
-rw-r--r--test/selenium/DbOperationsTest.php3
-rw-r--r--test/selenium/LoginTest.php3
-rw-r--r--test/selenium/SqlQueryTest.php4
-rw-r--r--test/selenium/TableCreateTest.php4
-rw-r--r--test/selenium/TestBase.php7
-rw-r--r--test/selenium/XssTest.php3
36 files changed, 356 insertions, 121 deletions
diff --git a/test/Environment_test.php b/test/EnvironmentTest.php
index f36b0f9813..6e0916398c 100644
--- a/test/Environment_test.php
+++ b/test/EnvironmentTest.php
@@ -7,19 +7,21 @@
*/
declare(strict_types=1);
+namespace PhpMyAdmin\Tests;
+
+use PHPUnit\Framework\TestCase;
+
/**
*
*/
require_once 'config.sample.inc.php';
-use PHPUnit\Framework\TestCase;
-
/**
* Environment tests
*
* @package PhpMyAdmin-test
*/
-class Environment_Test extends TestCase
+class EnvironmentTest extends TestCase
{
/**
* Tests PHP version
diff --git a/test/classes/AdvisorTest.php b/test/classes/AdvisorTest.php
index 3ef931d840..fae6e2dd35 100644
--- a/test/classes/AdvisorTest.php
+++ b/test/classes/AdvisorTest.php
@@ -79,6 +79,9 @@ class AdvisorTest extends PmaTestCase
/**
* test for Advisor::byTime
*
+ * @param float $time time
+ * @param string $expected expected result
+ *
* @return void
*
* @dataProvider advisorTimes
@@ -89,6 +92,9 @@ class AdvisorTest extends PmaTestCase
$this->assertEquals($expected, $result);
}
+ /**
+ * @return array
+ */
public function advisorTimes()
{
return array(
diff --git a/test/classes/CharsetsTest.php b/test/classes/CharsetsTest.php
index 823e4e4353..4e19be3d2d 100644
--- a/test/classes/CharsetsTest.php
+++ b/test/classes/CharsetsTest.php
@@ -19,6 +19,9 @@ use PHPUnit\Framework\TestCase;
*/
class CharsetsTest extends TestCase
{
+ /**
+ * @return void
+ */
public function setUp()
{
$GLOBALS['cfg']['DBG']['sql'] = false;
diff --git a/test/classes/Config/DescriptionTest.php b/test/classes/Config/DescriptionTest.php
index e25205f394..9f85886ce6 100644
--- a/test/classes/Config/DescriptionTest.php
+++ b/test/classes/Config/DescriptionTest.php
@@ -31,6 +31,12 @@ class DescriptionTest extends PmaTestCase
}
/**
+ * @param string $item item
+ * @param string $type type
+ * @param string $expected expected result
+ *
+ * @return void
+ *
* @dataProvider getValues
*/
public function testGet($item, $type, $expected)
@@ -38,6 +44,9 @@ class DescriptionTest extends PmaTestCase
$this->assertEquals($expected, Descriptions::get($item, $type));
}
+ /**
+ * @return array
+ */
public function getValues()
{
return array(
@@ -62,6 +71,8 @@ class DescriptionTest extends PmaTestCase
/**
* Assertion for getting description key
*
+ * @param string $key key
+ *
* @return void
*/
public function assertGet($key)
@@ -72,7 +83,9 @@ class DescriptionTest extends PmaTestCase
}
/**
- * Test getting all names for configuratons
+ * Test getting all names for configurations
+ *
+ * @return void
*/
public function testAll()
{
diff --git a/test/classes/Config/Forms/FormListTest.php b/test/classes/Config/Forms/FormListTest.php
index 855a2ed44d..8eb9b546f9 100644
--- a/test/classes/Config/Forms/FormListTest.php
+++ b/test/classes/Config/Forms/FormListTest.php
@@ -23,6 +23,9 @@ use PhpMyAdmin\Tests\PmaTestCase;
*/
class FormListTest extends PmaTestCase
{
+ /**
+ * @return void
+ */
public function setUp()
{
$GLOBALS['PMA_Config'] = new Config();
@@ -35,6 +38,8 @@ class FormListTest extends PmaTestCase
* @param string $class Class to test
* @param string $prefix Reuturned class prefix
*
+ * @return void
+ *
* @dataProvider formObjects
*/
public function testForms($class, $prefix)
@@ -65,6 +70,9 @@ class FormListTest extends PmaTestCase
$this->assertEquals('', $forms->displayErrors());
}
+ /**
+ * @return array
+ */
public function formObjects()
{
return array(
diff --git a/test/classes/Config/ServerConfigChecksTest.php b/test/classes/Config/ServerConfigChecksTest.php
index f32d3a39af..833e61b5c4 100644
--- a/test/classes/Config/ServerConfigChecksTest.php
+++ b/test/classes/Config/ServerConfigChecksTest.php
@@ -22,8 +22,16 @@ use ReflectionProperty;
*/
class ServeConfigChecksTest extends PmaTestCase
{
+ /**
+ * @var string
+ */
private $sessionID;
+ /**
+ * @throws \ReflectionException
+ *
+ * @return void
+ */
public function setUp()
{
$GLOBALS['PMA_Config'] = new Config();
@@ -42,6 +50,9 @@ class ServeConfigChecksTest extends PmaTestCase
unset($_SESSION[$this->sessionID]);
}
+ /**
+ * @return void
+ */
public function testManyErrors()
{
$_SESSION[$this->sessionID]['Servers'] = array(
@@ -100,6 +111,9 @@ class ServeConfigChecksTest extends PmaTestCase
);
}
+ /**
+ * @return void
+ */
public function testBlowfishCreate()
{
$_SESSION[$this->sessionID]['Servers'] = array(
@@ -134,9 +148,11 @@ class ServeConfigChecksTest extends PmaTestCase
);
}
+ /**
+ * @return void
+ */
public function testBlowfish()
{
-
$_SESSION[$this->sessionID]['blowfish_secret'] = 'sec';
$_SESSION[$this->sessionID]['Servers'] = array(
diff --git a/test/classes/ConfigTest.php b/test/classes/ConfigTest.php
index 681ed5f65a..d2649fbf6c 100644
--- a/test/classes/ConfigTest.php
+++ b/test/classes/ConfigTest.php
@@ -486,6 +486,15 @@ class ConfigTest extends PmaTestCase
/**
* test for IsHttp
*
+ * @param string $scheme http scheme
+ * @param string $https https
+ * @param string $uri request uri
+ * @param string $lb http https from lb
+ * @param string $front http front end https
+ * @param string $proto http x forwarded proto
+ * @param int $port server port
+ * @param bool $expected expected result
+ *
* @return void
*
* @dataProvider httpsParams
@@ -1024,6 +1033,10 @@ class ConfigTest extends PmaTestCase
/**
* Test for checkServers
*
+ * @param array $settings settings array
+ * @param array $expected expected result
+ * @param bool $error error
+ *
* @return void
*
* @dataProvider serverSettingsProvider
@@ -1075,6 +1088,10 @@ class ConfigTest extends PmaTestCase
/**
* Test for selectServer
*
+ * @param array $settings settings array
+ * @param string $request request
+ * @param int $expected expected result
+ *
* @return void
*
* @dataProvider selectServerProvider
diff --git a/test/classes/Controllers/Table/TableRelationControllerTest.php b/test/classes/Controllers/Table/TableRelationControllerTest.php
index 368690ba1c..fea73928c2 100644
--- a/test/classes/Controllers/Table/TableRelationControllerTest.php
+++ b/test/classes/Controllers/Table/TableRelationControllerTest.php
@@ -41,8 +41,18 @@ class TableRelationControllerTest extends PmaTestCase
$_REQUEST['foreignDb'] = 'db';
$_REQUEST['foreignTable'] = 'table';
- $GLOBALS['dblist'] = new DataBasePMAMockForTblRelation();
- $GLOBALS['dblist']->databases = new DataBaseMockForTblRelation();
+ $GLOBALS['dblist'] = new \stdClass();
+ $GLOBALS['dblist']->databases = new class
+ {
+ /**
+ * @param mixed $name name
+ * @return bool
+ */
+ public function exists($name)
+ {
+ return true;
+ }
+ };
$indexes = array(
array(
@@ -259,33 +269,3 @@ class TableRelationControllerTest extends PmaTestCase
);
}
}
-
-/**
- * Mock class for DataBasePMAMock
- *
- * @package PhpMyAdmin-test
- */
-Class DataBasePMAMockForTblRelation
-{
- var $databases;
-}
-
-/**
- * Mock class for DataBaseMock
- *
- * @package PhpMyAdmin-test
- */
-Class DataBaseMockForTblRelation
-{
- /**
- * mock function to return table is existed
- *
- * @param string $name table name
- *
- * @return bool
- */
- function exists($name)
- {
- return true;
- }
-}
diff --git a/test/classes/Database/SearchTest.php b/test/classes/Database/SearchTest.php
index 202399d82f..1b67fd73ba 100644
--- a/test/classes/Database/SearchTest.php
+++ b/test/classes/Database/SearchTest.php
@@ -76,7 +76,7 @@ class SearchTest extends PmaTestCase
* @param string $name method name
* @param array $params parameters for the invocation
*
- * @return the output from the protected method.
+ * @return mixed the output from the protected method.
*/
private function callProtectedFunction($name, $params)
{
@@ -89,6 +89,11 @@ class SearchTest extends PmaTestCase
/**
* Test for generating where clause for different search types
*
+ * @param string $type type
+ * @param string $expected expected result
+ *
+ * @return void
+ *
* @dataProvider searchTypes
*/
public function testGetWhereClause($type, $expected)
diff --git a/test/classes/DatabaseInterfaceTest.php b/test/classes/DatabaseInterfaceTest.php
index cf5615dcb3..e9fadc73f5 100644
--- a/test/classes/DatabaseInterfaceTest.php
+++ b/test/classes/DatabaseInterfaceTest.php
@@ -21,6 +21,9 @@ use PhpMyAdmin\Util;
*/
class DatabaseInterfaceTest extends PmaTestCase
{
+ /**
+ * @var DatabaseInterface
+ */
private $_dbi;
/**
@@ -38,6 +41,10 @@ class DatabaseInterfaceTest extends PmaTestCase
/**
* Tests for DBI::getCurrentUser() method.
*
+ * @param array $value value
+ * @param string $string string
+ * @param array $expected expected result
+ *
* @return void
* @test
* @dataProvider currentUserData
@@ -92,11 +99,11 @@ class DatabaseInterfaceTest extends PmaTestCase
->method('realQuery')
->will($this->returnValue(true));
- $meta1 = new FieldMeta();
+ $meta1 = new \stdClass();
$meta1->table = "meta1_table";
$meta1->name = "meta1_name";
- $meta2 = new FieldMeta();
+ $meta2 = new \stdClass();
$meta2->table = "meta2_table";
$meta2->name = "meta2_name";
@@ -371,6 +378,8 @@ class DatabaseInterfaceTest extends PmaTestCase
* @param string $error_message Error message as returned by server
* @param string $match Expected text
*
+ * @return void
+ *
* @dataProvider errorData
*/
public function testFormatError($error_number, $error_message, $match)
@@ -381,6 +390,9 @@ class DatabaseInterfaceTest extends PmaTestCase
);
}
+ /**
+ * @return array
+ */
public function errorData()
{
return array(
@@ -396,6 +408,9 @@ class DatabaseInterfaceTest extends PmaTestCase
/**
* Tests for DBI::isAmazonRds() method.
*
+ * @param mixed $value value
+ * @param mixed $expected expected result
+ *
* @return void
* @test
* @dataProvider isAmazonRdsData
@@ -450,6 +465,9 @@ class DatabaseInterfaceTest extends PmaTestCase
$this->assertEquals($upgrade, $ver_int < $GLOBALS['cfg']['MysqlMinVersion']['internal']);
}
+ /**
+ * @return array
+ */
public function versionData()
{
return array(
@@ -499,14 +517,3 @@ class DatabaseInterfaceTest extends PmaTestCase
$dbi->setCollation('utf8mb4_bin_ci');
}
}
-
-/**
- * class for Table Field Meta
- *
- * @package PhpMyAdmin-test
- */
-class FieldMeta
-{
- public $table;
- public $name;
-}
diff --git a/test/classes/EncodingTest.php b/test/classes/EncodingTest.php
index 418b69d4aa..2e4be43d10 100644
--- a/test/classes/EncodingTest.php
+++ b/test/classes/EncodingTest.php
@@ -19,11 +19,17 @@ use PHPUnit\Framework\TestCase;
*/
class EncodingTest extends TestCase
{
+ /**
+ * @return void
+ */
public function setUp()
{
Encoding::initEngine();
}
+ /**
+ * @return void
+ */
public function tearDown()
{
Encoding::initEngine();
@@ -45,6 +51,9 @@ class EncodingTest extends TestCase
);
}
+ /**
+ * @return void
+ */
public function testInvalidConversion()
{
// Invalid value to use default case
@@ -55,6 +64,9 @@ class EncodingTest extends TestCase
);
}
+ /**
+ * @return void
+ */
public function testRecode()
{
if (! function_exists('recode_string')) {
@@ -70,6 +82,9 @@ class EncodingTest extends TestCase
);
}
+ /**
+ * @return void
+ */
public function testIconv()
{
if (! function_exists('iconv')) {
@@ -86,6 +101,9 @@ class EncodingTest extends TestCase
);
}
+ /**
+ * @return void
+ */
public function testMbstring()
{
Encoding::setEngine(Encoding::ENGINE_MB);
@@ -100,9 +118,6 @@ class EncodingTest extends TestCase
/**
* Test for kanjiChangeOrder
*
- * @param string $kanji_test_list current list
- * @param string $expected expected list
- *
* @return void
* @test
*/
@@ -204,6 +219,9 @@ class EncodingTest extends TestCase
);
}
+ /**
+ * @return void
+ */
public function testListEncodings()
{
$GLOBALS['cfg']['AvailableCharsets'] = ['utf-8'];
diff --git a/test/classes/ErrorTest.php b/test/classes/ErrorTest.php
index cefb8fbea1..6ea6c31e90 100644
--- a/test/classes/ErrorTest.php
+++ b/test/classes/ErrorTest.php
@@ -21,6 +21,7 @@ use PhpMyAdmin\Theme;
class ErrorTest extends PmaTestCase
{
/**
+ * @var Error
* @access protected
*/
protected $object;
@@ -76,6 +77,9 @@ class ErrorTest extends PmaTestCase
/**
* Test for setFile
*
+ * @param string $file actual
+ * @param string $expected expected
+ *
* @return void
*
* @dataProvider filePathProvider
diff --git a/test/classes/FontTest.php b/test/classes/FontTest.php
index 13d27971ed..69fa2eeb8d 100644
--- a/test/classes/FontTest.php
+++ b/test/classes/FontTest.php
@@ -25,6 +25,8 @@ class FontTest extends PmaTestCase
/**
* Sets up the fixture
+ *
+ * @return void
*/
protected function setUp()
{
diff --git a/test/classes/IpAllowDenyTest.php b/test/classes/IpAllowDenyTest.php
index f7c89b66cd..fe3574c2e2 100644
--- a/test/classes/IpAllowDenyTest.php
+++ b/test/classes/IpAllowDenyTest.php
@@ -55,6 +55,11 @@ class IpAllowDenyTest extends TestCase
/**
* Test for Core::getIp
*
+ * @param string $remote remote
+ * @param string $header header
+ * @param string $expected expected result
+ * @param string $proxyip proxyip
+ *
* @return void
*
* @dataProvider proxyIPs
diff --git a/test/classes/LanguageTest.php b/test/classes/LanguageTest.php
index efe73e378c..cd7c1e3b49 100644
--- a/test/classes/LanguageTest.php
+++ b/test/classes/LanguageTest.php
@@ -19,6 +19,9 @@ use PhpMyAdmin\Tests\PmaTestCase;
*/
class LanguageTest extends PmaTestCase
{
+ /**
+ * @var LanguageManager
+ */
private $manager;
/**
@@ -35,6 +38,9 @@ class LanguageTest extends PmaTestCase
$this->manager = new LanguageManager();
}
+ /**
+ * @return void
+ */
public function tearDown()
{
// Ensure we have English locale after tests
diff --git a/test/classes/Plugins/Auth/AuthenticationCookieTest.php b/test/classes/Plugins/Auth/AuthenticationCookieTest.php
index 2a60dbca19..ba2c09011f 100644
--- a/test/classes/Plugins/Auth/AuthenticationCookieTest.php
+++ b/test/classes/Plugins/Auth/AuthenticationCookieTest.php
@@ -36,7 +36,7 @@ class AuthenticationCookieTest extends PmaTestCase
*
* @return void
*/
- function setup()
+ protected function setUp()
{
$GLOBALS['PMA_Config'] = new Config();
$GLOBALS['PMA_Config']->enableBc();
@@ -92,6 +92,9 @@ class AuthenticationCookieTest extends PmaTestCase
);
}
+ /**
+ * @return void
+ */
private function getAuthErrorMockResponse()
{
$mockResponse = $this->mockResponse();
@@ -769,6 +772,9 @@ class AuthenticationCookieTest extends PmaTestCase
}
+ /**
+ * @return void
+ */
public function testAuthFailsDeny()
{
$this->object = $this->getMockBuilder('PhpMyAdmin\Plugins\Auth\AuthenticationCookie')
@@ -791,6 +797,9 @@ class AuthenticationCookieTest extends PmaTestCase
);
}
+ /**
+ * @return void
+ */
public function testAuthFailsActivity()
{
$this->object = $this->getMockBuilder('PhpMyAdmin\Plugins\Auth\AuthenticationCookie')
@@ -816,6 +825,9 @@ class AuthenticationCookieTest extends PmaTestCase
);
}
+ /**
+ * @return void
+ */
public function testAuthFailsDBI()
{
$this->object = $this->getMockBuilder('PhpMyAdmin\Plugins\Auth\AuthenticationCookie')
@@ -849,6 +861,9 @@ class AuthenticationCookieTest extends PmaTestCase
);
}
+ /**
+ * @return void
+ */
public function testAuthFailsErrno()
{
$this->object = $this->getMockBuilder('PhpMyAdmin\Plugins\Auth\AuthenticationCookie')
@@ -1036,6 +1051,10 @@ class AuthenticationCookieTest extends PmaTestCase
/**
* Test for secret splitting using getAESSecret
*
+ * @param string $secret secret
+ * @param string $mac mac
+ * @param string $aes aes
+ *
* @return void
*
* @dataProvider secretsProvider
@@ -1051,6 +1070,10 @@ class AuthenticationCookieTest extends PmaTestCase
/**
* Test for secret splitting using getMACSecret and getAESSecret
*
+ * @param string $secret secret
+ * @param string $mac mac
+ * @param string $aes aes
+ *
* @return void
*
* @dataProvider secretsProvider
@@ -1063,6 +1086,11 @@ class AuthenticationCookieTest extends PmaTestCase
);
}
+ /**
+ * @throws \ReflectionException
+ *
+ * @return void
+ */
public function testPasswordChange()
{
$newPassword = 'PMAPASSWD2';
@@ -1167,6 +1195,14 @@ class AuthenticationCookieTest extends PmaTestCase
/**
* Test for PhpMyAdmin\Plugins\Auth\AuthenticationCookie::checkRules
*
+ * @param string $user user
+ * @param string $pass pass
+ * @param string $ip ip
+ * @param bool $root root
+ * @param bool $nopass nopass
+ * @param array $rules rules
+ * @param string $expected expected result
+ *
* @return void
*
* @dataProvider checkRulesProvider
@@ -1198,6 +1234,9 @@ class AuthenticationCookieTest extends PmaTestCase
}
}
+ /**
+ * @return array
+ */
public function checkRulesProvider()
{
return array(
diff --git a/test/classes/Plugins/Auth/AuthenticationHttpTest.php b/test/classes/Plugins/Auth/AuthenticationHttpTest.php
index aaa1d5f499..fe98e14fc6 100644
--- a/test/classes/Plugins/Auth/AuthenticationHttpTest.php
+++ b/test/classes/Plugins/Auth/AuthenticationHttpTest.php
@@ -57,6 +57,14 @@ class AuthenticationHttpTest extends PmaTestCase
unset($this->object);
}
+ /**
+ * @param mixed $set_minimal set minimal
+ * @param mixed $body_id body id
+ * @param mixed $set_title set title
+ * @param mixed ... $headers headers
+ *
+ * @return void
+ */
public function doMockResponse($set_minimal, $body_id, $set_title, ...$headers)
{
// mock footer
@@ -133,6 +141,9 @@ class AuthenticationHttpTest extends PmaTestCase
);
}
+ /**
+ * @return void
+ */
public function testAuthVerbose()
{
$_REQUEST['old_usr'] = '';
@@ -146,6 +157,9 @@ class AuthenticationHttpTest extends PmaTestCase
);
}
+ /**
+ * @return void
+ */
public function testAuthHost()
{
$GLOBALS['cfg']['Server']['verbose'] = '';
@@ -159,6 +173,9 @@ class AuthenticationHttpTest extends PmaTestCase
);
}
+ /**
+ * @return void
+ */
public function testAuthRealm()
{
$GLOBALS['cfg']['Server']['host'] = '';
diff --git a/test/classes/PmaTestCase.php b/test/classes/PmaTestCase.php
index d226027a2a..a146274649 100644
--- a/test/classes/PmaTestCase.php
+++ b/test/classes/PmaTestCase.php
@@ -20,11 +20,19 @@ use ReflectionProperty;
*/
class PmaTestCase extends TestCase
{
+ /**
+ * @var Response
+ */
protected $restoreInstance = null;
+ /**
+ * @var Response
+ */
protected $attrInstance = null;
/**
* This method is called before the first test of this test class is run.
+ *
+ * @return void
*/
public static function setUpBeforeClass()
{
diff --git a/test/classes/SanitizeTest.php b/test/classes/SanitizeTest.php
index acd53a5c7a..b263df53b1 100644
--- a/test/classes/SanitizeTest.php
+++ b/test/classes/SanitizeTest.php
@@ -20,15 +20,6 @@ use PHPUnit\Framework\TestCase;
class SanitizeTest extends TestCase
{
/**
- * Setup various pre conditions
- *
- * @return void
- */
- function setUp()
- {
- }
-
- /**
* Tests for proper escaping of XSS.
*
* @return void
@@ -63,6 +54,9 @@ class SanitizeTest extends TestCase
/**
* Tests links to documentation.
*
+ * @param string $link link
+ * @param string $expected expected result
+ *
* @return void
*
* @dataProvider docLinks
diff --git a/test/classes/TableTest.php b/test/classes/TableTest.php
index 729e1f9df8..58de980559 100644
--- a/test/classes/TableTest.php
+++ b/test/classes/TableTest.php
@@ -46,8 +46,18 @@ class TableTest extends PmaTestCase
$relation = new Relation();
$GLOBALS['cfgRelation'] = $relation->getRelationsParam();
- $GLOBALS['dblist'] = new DataBasePMAMock();
- $GLOBALS['dblist']->databases = new DataBaseMock();
+ $GLOBALS['dblist'] = new \stdClass();
+ $GLOBALS['dblist']->databases = new class
+ {
+ /**
+ * @param mixed $name name
+ * @return bool
+ */
+ public function exists($name)
+ {
+ return true;
+ }
+ };
$sql_isView_true = "SELECT TABLE_NAME
FROM information_schema.VIEWS
@@ -377,14 +387,15 @@ class TableTest extends PmaTestCase
/**
* Test name validation
*
- * @param string $name name to test
- * @param boolean $result expected result
+ * @param string $name name to test
+ * @param boolean $result expected result
+ * @param boolean $is_backquoted is backquoted
*
* @return void
*
* @dataProvider dataValidateName
*/
- public function testValidateName($name, $result, $is_backquoted=false)
+ public function testValidateName($name, $result, $is_backquoted = false)
{
$this->assertEquals(
$result,
@@ -1353,35 +1364,4 @@ class TableTest extends PmaTestCase
$create_options
);
}
-
-}
-
-/**
- * Mock class for DataBasePMAMock
- *
- * @package PhpMyAdmin-test
- */
-Class DataBasePMAMock
-{
- var $databases;
-}
-
-/**
- * Mock class for DataBaseMock
- *
- * @package PhpMyAdmin-test
- */
-Class DataBaseMock
-{
- /**
- * mock function to return table is existed
- *
- * @param string $name table name
- *
- * @return bool
- */
- function exists($name)
- {
- return true;
- }
}
diff --git a/test/classes/TransformationsTest.php b/test/classes/TransformationsTest.php
index 3981c9d853..d37f926a2b 100644
--- a/test/classes/TransformationsTest.php
+++ b/test/classes/TransformationsTest.php
@@ -261,6 +261,11 @@ class TransformationsTest extends TestCase
}
/**
+ * @param string $value value
+ * @param string $expected expected result
+ *
+ * @return void
+ *
* @dataProvider fixupData
*/
public function testFixup($value, $expected)
@@ -271,6 +276,9 @@ class TransformationsTest extends TestCase
);
}
+ /**
+ * @return array
+ */
public function fixupData()
{
return array(
diff --git a/test/classes/TwoFactorTest.php b/test/classes/TwoFactorTest.php
index 260ab5513b..01c1623f54 100644
--- a/test/classes/TwoFactorTest.php
+++ b/test/classes/TwoFactorTest.php
@@ -20,6 +20,9 @@ use Samyoul\U2F\U2FServer\SignRequest;
*/
class TwoFactorTest extends PmaTestCase
{
+ /**
+ * @return void
+ */
public function setUp()
{
$GLOBALS['server'] = 1;
@@ -53,6 +56,9 @@ class TwoFactorTest extends PmaTestCase
return $result;
}
+ /**
+ * @return void
+ */
public function testNone()
{
$object = $this->getTwoFactorMock('user', ['type' => 'db']);
@@ -68,6 +74,9 @@ class TwoFactorTest extends PmaTestCase
$this->assertEquals('', $object->setup());
}
+ /**
+ * @return void
+ */
public function testSimple()
{
$GLOBALS['cfg']['DBG']['simple2fa'] = true;
@@ -88,6 +97,9 @@ class TwoFactorTest extends PmaTestCase
$this->assertEquals('', $object->setup());
}
+ /**
+ * @return void
+ */
public function testLoad()
{
$object = new TwoFactor('user');
@@ -95,6 +107,9 @@ class TwoFactorTest extends PmaTestCase
$this->assertEquals('', $backend::$id);
}
+ /**
+ * @return void
+ */
public function testConfigureSimple()
{
$GLOBALS['cfg']['DBG']['simple2fa'] = true;
@@ -110,6 +125,9 @@ class TwoFactorTest extends PmaTestCase
$this->assertFalse($object->configure('simple'));
}
+ /**
+ * @return void
+ */
public function testApplication()
{
$object = new TwoFactor('user');
@@ -150,6 +168,9 @@ class TwoFactorTest extends PmaTestCase
$this->assertNotEquals('', $object->setup());
}
+ /**
+ * @return void
+ */
public function testKey()
{
$object = new TwoFactor('user');
@@ -188,6 +209,8 @@ class TwoFactorTest extends PmaTestCase
/**
* Test getting AppId
+ *
+ * @return void
*/
public function testKeyAppId()
{
@@ -211,6 +234,8 @@ class TwoFactorTest extends PmaTestCase
/**
* Test based on upstream test data:
* https://github.com/Yubico/php-u2flib-server
+ *
+ * @return void
*/
public function testKeyAuthentication()
{
@@ -246,6 +271,8 @@ class TwoFactorTest extends PmaTestCase
/**
* Test listing of available backends.
+ *
+ * @return void
*/
public function testBackends()
{
diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php
index 939eb2f2c6..4f91c5ea99 100644
--- a/test/classes/UtilTest.php
+++ b/test/classes/UtilTest.php
@@ -138,6 +138,8 @@ class UtilTest extends PmaTestCase
/**
* Test for random generation
+ *
+ * @return void
*/
public function testGenerateRandom()
{
@@ -2049,6 +2051,10 @@ class UtilTest extends PmaTestCase
/**
* Test for Util::linkOrButton
*
+ * @param array $params params
+ * @param int $limit limit
+ * @param string $match match
+ *
* @return void
*
* @dataProvider linksOrButtons
diff --git a/test/classes/Utils/HttpRequestTest.php b/test/classes/Utils/HttpRequestTest.php
index 3f2870ce1c..1623d8e8b7 100644
--- a/test/classes/Utils/HttpRequestTest.php
+++ b/test/classes/Utils/HttpRequestTest.php
@@ -1,4 +1,10 @@
<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * tests for PhpMyAdmin\Utils\HttpRequest class
+ *
+ * @package PhpMyAdmin-test
+ */
declare(strict_types=1);
namespace PhpMyAdmin\Tests\Utils;
@@ -7,10 +13,20 @@ use PhpMyAdmin\Utils\HttpRequest;
use PhpMyAdmin\Tests\PmaTestCase;
use ReflectionClass;
+/**
+ * Class HttpRequestTest
+ * @package PhpMyAdmin\Tests\Utils
+ */
class HttpRequestTest extends PmaTestCase
{
+ /**
+ * @var HttpRequest
+ */
private $httpRequest;
+ /**
+ * @return void
+ */
protected function setUp()
{
$this->httpRequest = new HttpRequest();
@@ -66,6 +82,11 @@ class HttpRequestTest extends PmaTestCase
/**
* Test for http request using Curl
*
+ * @param string $url url
+ * @param string $method method
+ * @param bool $return_only_status return only status
+ * @param bool $expected expected result
+ *
* @group medium
*
* @return void
@@ -84,6 +105,11 @@ class HttpRequestTest extends PmaTestCase
/**
* Test for http request using Curl with CURLOPT_CAPATH
*
+ * @param string $url url
+ * @param string $method method
+ * @param bool $return_only_status return only status
+ * @param bool $expected expected result
+ *
* @group medium
*
* @return void
@@ -109,6 +135,11 @@ class HttpRequestTest extends PmaTestCase
/**
* Test for http request using Curl with CURLOPT_CAINFO
*
+ * @param string $url url
+ * @param string $method method
+ * @param bool $return_only_status return only status
+ * @param bool $expected expected result
+ *
* @group medium
*
* @return void
@@ -134,6 +165,11 @@ class HttpRequestTest extends PmaTestCase
/**
* Test for http request using fopen
*
+ * @param string $url url
+ * @param string $method method
+ * @param bool $return_only_status return only status
+ * @param bool $expected expected result
+ *
* @group medium
*
* @return void
@@ -155,6 +191,11 @@ class HttpRequestTest extends PmaTestCase
/**
* Test for http request using generic interface
*
+ * @param string $url url
+ * @param string $method method
+ * @param bool $return_only_status return only status
+ * @param bool $expected expected result
+ *
* @group medium
*
* @return void
diff --git a/test/classes/ZipExtensionTest.php b/test/classes/ZipExtensionTest.php
index 6a8bfb8b5c..afc6d47c8d 100644
--- a/test/classes/ZipExtensionTest.php
+++ b/test/classes/ZipExtensionTest.php
@@ -19,8 +19,14 @@ use ZipArchive;
*/
class ZipExtensionTest extends PmaTestCase
{
+ /**
+ * @var ZipExtension
+ */
private $zipExtension;
+ /**
+ * @return void
+ */
protected function setUp()
{
$this->zipExtension = new ZipExtension();
@@ -142,6 +148,8 @@ class ZipExtensionTest extends PmaTestCase
/**
* Helper function to get ZipArchive for content.
*
+ * @param mixed $file file
+ *
* @return ZipArchive
*/
private function getZip($file)
diff --git a/test/libraries/database_interface_test.php b/test/libraries/DummyDbiTest.php
index 5d46688a04..1e54cb2674 100644
--- a/test/libraries/database_interface_test.php
+++ b/test/libraries/DummyDbiTest.php
@@ -7,6 +7,8 @@
*/
declare(strict_types=1);
+namespace PhpMyAdmin\Tests;
+
use PHPUnit\Framework\TestCase;
/**
@@ -14,14 +16,14 @@ use PHPUnit\Framework\TestCase;
*
* @package PhpMyAdmin-test
*/
-class PMA_DBI_Test extends TestCase
+class DummyDbiTest extends TestCase
{
/**
* Configures test parameters.
*
* @return void
*/
- function setup()
+ protected function setUp()
{
$GLOBALS['cfg']['DBG']['sql'] = false;
$GLOBALS['cfg']['IconvExtraParams'] = '';
diff --git a/test/libraries/Files_test.php b/test/libraries/FilesTest.php
index b938478ce0..bf08ef21da 100644
--- a/test/libraries/Files_test.php
+++ b/test/libraries/FilesTest.php
@@ -7,6 +7,8 @@
*/
declare(strict_types=1);
+namespace PhpMyAdmin\Tests;
+
use PHPUnit\Framework\TestCase;
/**
@@ -17,21 +19,10 @@ use PHPUnit\Framework\TestCase;
class FilesTest extends TestCase
{
/**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- * @return void
- */
- public function setUp()
- {
- }
-
- /**
* Test for dynamic javascript files
*
- * @param $name string Filename to test
- * @param $expected string Expected output
+ * @param string $name Filename to test
+ * @param string $expected Expected output
*
* @return void
*
diff --git a/test/libraries/common/PMA_checkbox_test.php b/test/libraries/common/GetCheckboxTest.php
index 3c19422157..f0badf5f7b 100644
--- a/test/libraries/common/PMA_checkbox_test.php
+++ b/test/libraries/common/GetCheckboxTest.php
@@ -8,6 +8,8 @@
*/
declare(strict_types=1);
+namespace PhpMyAdmin\Tests;
+
use PHPUnit\Framework\TestCase;
/**
@@ -16,7 +18,7 @@ use PHPUnit\Framework\TestCase;
* @package PhpMyAdmin-test
* @group common.lib-tests
*/
-class PMA_GetCheckboxTest extends TestCase
+class GetCheckboxTest extends TestCase
{
/**
* Test for checkbox.phtml
diff --git a/test/selenium/CreateDropDatabaseTest.php b/test/selenium/CreateDropDatabaseTest.php
index 65c492cc22..83a433c2df 100644
--- a/test/selenium/CreateDropDatabaseTest.php
+++ b/test/selenium/CreateDropDatabaseTest.php
@@ -31,6 +31,9 @@ class CreateDropDatabaseTest extends TestBase
$this->skipIfNotSuperUser();
}
+ /**
+ * @return void
+ */
public function setUpPage()
{
parent::setUpPage();
diff --git a/test/selenium/CreateRemoveUserTest.php b/test/selenium/CreateRemoveUserTest.php
index 698a2b703e..d882188e6c 100644
--- a/test/selenium/CreateRemoveUserTest.php
+++ b/test/selenium/CreateRemoveUserTest.php
@@ -48,6 +48,9 @@ class CreateRemoveUserTest extends TestBase
$this->_txtPassword = 'abc_123';
}
+ /**
+ * @return void
+ */
public function setUpPage()
{
parent::setUpPage();
diff --git a/test/selenium/DbOperationsTest.php b/test/selenium/DbOperationsTest.php
index b7d4369400..521f91b0cb 100644
--- a/test/selenium/DbOperationsTest.php
+++ b/test/selenium/DbOperationsTest.php
@@ -30,6 +30,9 @@ class DbOperationsTest extends TestBase
$this->login();
}
+ /**
+ * @return void
+ */
private function _getToDBOperations()
{
$this->gotoHomepage();
diff --git a/test/selenium/LoginTest.php b/test/selenium/LoginTest.php
index bb2bdff3f8..2282ecae88 100644
--- a/test/selenium/LoginTest.php
+++ b/test/selenium/LoginTest.php
@@ -19,6 +19,9 @@ namespace PhpMyAdmin\Tests\Selenium;
*/
class LoginTest extends TestBase
{
+ /**
+ * @return void
+ */
public function setUpPage()
{
parent::setUpPage();
diff --git a/test/selenium/SqlQueryTest.php b/test/selenium/SqlQueryTest.php
index e9379b6a8f..b615906484 100644
--- a/test/selenium/SqlQueryTest.php
+++ b/test/selenium/SqlQueryTest.php
@@ -19,7 +19,6 @@ namespace PhpMyAdmin\Tests\Selenium;
*/
class SqlQueryTest extends TestBase
{
-
/**
* Setup the browser environment to run the selenium test case
*
@@ -168,6 +167,9 @@ class SqlQueryTest extends TestBase
$this->_testInlineEdit();
}
+ /**
+ * @return void
+ */
private function _testInlineEdit()
{
$this->waitForElement('byCssSelector', 'a.inline_edit_sql')->click();
diff --git a/test/selenium/TableCreateTest.php b/test/selenium/TableCreateTest.php
index becde358b8..33587bbed5 100644
--- a/test/selenium/TableCreateTest.php
+++ b/test/selenium/TableCreateTest.php
@@ -19,7 +19,9 @@ namespace PhpMyAdmin\Tests\Selenium;
*/
class TableCreateTest extends TestBase
{
-
+ /**
+ * @return void
+ */
public function setUpPage()
{
parent::setUpPage();
diff --git a/test/selenium/TestBase.php b/test/selenium/TestBase.php
index 024e078742..9fc95db956 100644
--- a/test/selenium/TestBase.php
+++ b/test/selenium/TestBase.php
@@ -28,7 +28,7 @@ abstract class TestBase extends Selenium2TestCase
* mysqli object
*
* @access private
- * @var mysqli
+ * @var \mysqli
*/
protected $_mysqli;
@@ -620,7 +620,8 @@ abstract class TestBase extends Selenium2TestCase
/**
* Navigates browser to a database page.
*
- * @param string $database Name of database
+ * @param string $database Name of database
+ * @param bool $gotoHomepageRequired Go to homepage required
*
* @return void
*/
@@ -721,7 +722,7 @@ abstract class TestBase extends Selenium2TestCase
/**
* Mark unsuccessful tests as 'Failures' on Browerstack
*
- * @param \Throwable $e
+ * @param \Throwable $e Throwable
*
* @return void
*/
diff --git a/test/selenium/XssTest.php b/test/selenium/XssTest.php
index 016ba7ccb2..d2c6d726b6 100644
--- a/test/selenium/XssTest.php
+++ b/test/selenium/XssTest.php
@@ -19,6 +19,9 @@ namespace PhpMyAdmin\Tests\Selenium;
*/
class XSSTest extends TestBase
{
+ /**
+ * @return void
+ */
public function setUpPage()
{
parent::setUpPage();