Skip to content

Commit b95aca9

Browse files
committed
Fix some coding standard issues on tests
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 7712a3e commit b95aca9

7 files changed

Lines changed: 11 additions & 17 deletions

File tree

test/classes/AbstractTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ protected function callFunction(object|null $object, string $className, string $
238238
* @param mixed $value The parameters for the invocation
239239
* @phpstan-param class-string $className
240240
*/
241-
protected function setProperty($object, string $className, string $propertyName, mixed $value): void
241+
protected function setProperty(object|null $object, string $className, string $propertyName, mixed $value): void
242242
{
243243
$class = new ReflectionClass($className);
244244
$property = $class->getProperty($propertyName);

test/classes/Advisory/AdvisorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function testAddRule(array $rule, array $expected, string|null $error): v
8282
$this->assertEquals([$error], $runResult['errors']);
8383
}
8484

85-
if ($runResult['fired'] === [] && $expected == []) {
85+
if ($runResult['fired'] === [] && $expected === []) {
8686
return;
8787
}
8888

test/classes/Config/DescriptionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ public function testAll(): void
123123

124124
foreach ($cfg as $key => $value) {
125125
$this->assertGet($key);
126-
if ($key == 'Servers') {
126+
if ($key === 'Servers') {
127127
$this->assertIsArray($value);
128128
$this->assertIsArray($value[1]);
129129
foreach ($value[1] as $item => $val) {
130130
$this->assertGet($key . '/1/' . $item);
131-
if ($item != 'AllowDeny') {
131+
if ($item !== 'AllowDeny') {
132132
continue;
133133
}
134134

test/classes/ConfigTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,9 @@ public function testCheckClient(
223223
$_SERVER['HTTP_USER_AGENT'] = $agent;
224224
$this->object->checkClient();
225225
$this->assertEquals($os, $this->object->get('PMA_USR_OS'));
226-
if ($os != null) {
227-
$this->assertEquals(
228-
$browser,
229-
$this->object->get('PMA_USR_BROWSER_AGENT'),
230-
);
231-
}
226+
$this->assertEquals($browser, $this->object->get('PMA_USR_BROWSER_AGENT'));
232227

233-
if ($version == null) {
228+
if ($version === null) {
234229
return;
235230
}
236231

test/classes/Plugins/Auth/AuthenticationHttpTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ protected function tearDown(): void
5252
unset($this->object);
5353
}
5454

55-
/** @param mixed ...$headers */
56-
public function doMockResponse(int $set_minimal, int $body_id, int $set_title, ...$headers): void
55+
public function doMockResponse(int $set_minimal, int $body_id, int $set_title, mixed ...$headers): void
5756
{
5857
$mockHeader = $this->getMockBuilder(Header::class)
5958
->disableOriginalConstructor()

test/classes/Stubs/DbiDummy.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function connect(string $user, string $password, Server $server): Connect
107107
*
108108
* @param string|DatabaseName $databaseName name of db to select
109109
*/
110-
public function selectDb($databaseName, Connection $connection): bool
110+
public function selectDb(string|DatabaseName $databaseName, Connection $connection): bool
111111
{
112112
$databaseName = $databaseName instanceof DatabaseName
113113
? $databaseName->getName() : $databaseName;
@@ -220,7 +220,7 @@ public function realQuery(string $query, Connection $connection, int $options):
220220
*
221221
* @param string $query multi query statement to execute
222222
*/
223-
public function realMultiQuery(Connection $connection, $query): bool
223+
public function realMultiQuery(Connection $connection, string $query): bool
224224
{
225225
return false;
226226
}
@@ -439,7 +439,7 @@ public function numFields(int $result): int
439439
*
440440
* @return string a MySQL escaped string
441441
*/
442-
public function escapeString(Connection $connection, $string): string
442+
public function escapeString(Connection $connection, string $string): string
443443
{
444444
return addslashes($string);
445445
}

test/classes/Stubs/ResponseRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function addHTML(string $content): void
6767
* @param mixed|null $value Null, if passing an array in $json otherwise
6868
* it's a string value to the key
6969
*/
70-
public function addJSON(string|int|array $json, $value = null): void
70+
public function addJSON(string|int|array $json, mixed $value = null): void
7171
{
7272
if (is_array($json)) {
7373
foreach ($json as $key => $value) {

0 commit comments

Comments
 (0)