Skip to content

Commit a5d60f5

Browse files
committed
Refactor the Server\PrivilegesTest test class
Removes the class properties to better isolate the test. Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent f68e2cb commit a5d60f5

3 files changed

Lines changed: 383 additions & 390 deletions

File tree

‎libraries/classes/DatabaseInterface.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use PhpMyAdmin\Query\Utilities;
2323
use PhpMyAdmin\SqlParser\Context;
2424
use PhpMyAdmin\Utils\SessionCache;
25+
use RuntimeException;
2526

2627
use function __;
2728
use function array_column;
@@ -2246,6 +2247,15 @@ public function getVersion(): int
22462247
return $this->versionInt;
22472248
}
22482249

2250+
public function setVersion(int $version): void
2251+
{
2252+
if (! defined('TESTSUITE')) {
2253+
throw new RuntimeException('This method should only be executed in a testing environment.');
2254+
}
2255+
2256+
$this->versionInt = $version;
2257+
}
2258+
22492259
/**
22502260
* Server version
22512261
*/

‎psalm-baseline.xml‎

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15825,12 +15825,9 @@
1582515825
<code>$title</code>
1582615826
</MixedArgument>
1582715827
<MixedArgumentTypeCoercion occurrences="1">
15828-
<code>$this-&gt;serverPrivileges-&gt;extractPrivInfo(null, true)</code>
15828+
<code>$serverPrivileges-&gt;extractPrivInfo(null, true)</code>
1582915829
</MixedArgumentTypeCoercion>
15830-
<MixedAssignment occurrences="1">
15831-
<code>$returned_userGroup</code>
15832-
</MixedAssignment>
15833-
<MixedMethodCall occurrences="19">
15830+
<MixedMethodCall occurrences="9">
1583415831
<code>getMessage</code>
1583515832
<code>getMessage</code>
1583615833
<code>getMessage</code>
@@ -15840,24 +15837,7 @@
1584015837
<code>getMessage</code>
1584115838
<code>getMessage</code>
1584215839
<code>getMessage</code>
15843-
<code>method</code>
15844-
<code>method</code>
15845-
<code>method</code>
15846-
<code>method</code>
15847-
<code>method</code>
15848-
<code>will</code>
15849-
<code>will</code>
15850-
<code>will</code>
15851-
<code>will</code>
15852-
<code>will</code>
1585315840
</MixedMethodCall>
15854-
<UndefinedMethod occurrences="5">
15855-
<code>expects</code>
15856-
<code>expects</code>
15857-
<code>expects</code>
15858-
<code>expects</code>
15859-
<code>expects</code>
15860-
</UndefinedMethod>
1586115841
<UnusedVariable occurrences="4">
1586215842
<code>$password</code>
1586315843
<code>$routinename</code>

0 commit comments

Comments
 (0)