Merge pull request #19584 from MauricioFauth/phpunit-12-deprecations

Fix PHPUnit 12 deprecations
This commit is contained in:
Maurício Meneghini Fauth 2025-01-30 15:52:23 -03:00 committed by GitHub
commit b0d985c349
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 5 additions and 43 deletions

View File

@ -17154,15 +17154,6 @@ parameters:
count: 1
path: tests/unit/Advisory/AdvisorTest.php
-
message: '''
#^Call to deprecated method assertContainsOnly\(\) of class PHPUnit\\Framework\\Assert\:
https\://github\.com/sebastianbergmann/phpunit/issues/6055$#
'''
identifier: staticMethod.deprecated
count: 1
path: tests/unit/Advisory/RulesTest.php
-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertArrayHasKey\(\) with ''formula'' and array\{id\: non\-empty\-string, name\: string, precondition\?\: non\-empty\-string, formula\: non\-empty\-string, test\: non\-empty\-string, issue\: string, recommendation\: string, justification\: string, \.\.\.\} will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
@ -17247,15 +17238,6 @@ parameters:
count: 1
path: tests/unit/CacheTest.php
-
message: '''
#^Call to deprecated method assertContainsOnly\(\) of class PHPUnit\\Framework\\Assert\:
https\://github\.com/sebastianbergmann/phpunit/issues/6055$#
'''
identifier: staticMethod.deprecated
count: 3
path: tests/unit/CharsetsTest.php
-
message: '#^Class PhpMyAdmin\\Tests\\Command\\SetVersionCommandTest has an uninitialized property \$command\. Give it default value or assign it in the constructor\.$#'
identifier: property.uninitialized
@ -18774,15 +18756,6 @@ parameters:
count: 2
path: tests/unit/DatabaseInterfaceTest.php
-
message: '''
#^Call to deprecated method isType\(\) of class PHPUnit\\Framework\\Assert\:
https\://github\.com/sebastianbergmann/phpunit/issues/6052$#
'''
identifier: staticMethod.deprecated
count: 1
path: tests/unit/DatabaseInterfaceTest.php
-
message: '#^Parameter \#2 \$result of method PhpMyAdmin\\Tests\\Stubs\\DbiDummy\:\:addResult\(\) expects bool\|list\<non\-empty\-list\<float\|int\|string\|null\>\>, array\<array\<string\>\>\|false given\.$#'
identifier: argument.type

View File

@ -9834,9 +9834,6 @@
</PossiblyUnusedMethod>
</file>
<file src="tests/unit/Advisory/RulesTest.php">
<DeprecatedMethod>
<code><![CDATA[self::assertContainsOnly('string', $rule)]]></code>
</DeprecatedMethod>
<PossiblyUnusedMethod>
<code><![CDATA[providerForTestRules]]></code>
</PossiblyUnusedMethod>
@ -9869,13 +9866,6 @@
<code><![CDATA[providerTestBuildDescription]]></code>
</PossiblyUnusedMethod>
</file>
<file src="tests/unit/CharsetsTest.php">
<DeprecatedMethod>
<code><![CDATA[self::assertContainsOnly('array', $collations)]]></code>
<code><![CDATA[self::assertContainsOnly('array', $collations)]]></code>
<code><![CDATA[self::assertContainsOnly('array', $collations)]]></code>
</DeprecatedMethod>
</file>
<file src="tests/unit/Command/SetVersionCommandTest.php">
<PossiblyUnusedMethod>
<code><![CDATA[dataProviderBadVersions]]></code>
@ -11133,7 +11123,6 @@
<code><![CDATA[Config::getInstance()]]></code>
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
<code><![CDATA[self::isType('object')]]></code>
</DeprecatedMethod>
<InaccessibleProperty>
<code><![CDATA[$config->config->debug->sql]]></code>

View File

@ -27,7 +27,7 @@ class RulesTest extends TestCase
self::assertArrayHasKey('issue', $rule);
self::assertArrayHasKey('recommendation', $rule);
self::assertArrayHasKey('justification', $rule);
self::assertContainsOnly('string', $rule);
self::assertContainsOnlyString($rule);
}
}

View File

@ -94,7 +94,7 @@ class CharsetsTest extends AbstractTestCase
$dbi = $this->createDatabaseInterface();
$collations = Charsets::getCollations($dbi, false);
self::assertCount(4, $collations);
self::assertContainsOnly('array', $collations);
self::assertContainsOnlyArray($collations);
foreach ($collations as $collation) {
self::assertContainsOnlyInstancesOf(Charsets\Collation::class, $collation);
}
@ -106,7 +106,7 @@ class CharsetsTest extends AbstractTestCase
$dbi->setVersion(['@@version' => '10.10.0-MariaDB']);
$collations = Charsets::getCollations($dbi, false);
self::assertCount(4, $collations);
self::assertContainsOnly('array', $collations);
self::assertContainsOnlyArray($collations);
foreach ($collations as $collation) {
self::assertContainsOnlyInstancesOf(Charsets\Collation::class, $collation);
}
@ -130,7 +130,7 @@ class CharsetsTest extends AbstractTestCase
$collations = Charsets::getCollations($dbi, true);
self::assertCount(4, $collations);
self::assertContainsOnly('array', $collations);
self::assertContainsOnlyArray($collations);
foreach ($collations as $collation) {
self::assertContainsOnlyInstancesOf(Charsets\Collation::class, $collation);
}

View File

@ -762,7 +762,7 @@ class DatabaseInterfaceTest extends AbstractTestCase
$resultStub = self::createStub(ResultInterface::class);
$dummyDbi = $this->createMock(DbiExtension::class);
$dummyDbi->expects(self::once())->method('executeQuery')
->with(self::isType('object'), self::equalTo($query), self::equalTo(['root', 'localhost']))
->with(self::isObject(), self::equalTo($query), self::equalTo(['root', 'localhost']))
->willReturn($resultStub);
$dbi = $this->createDatabaseInterface($dummyDbi);
$stmt = $dbi->executeQuery($query, ['root', 'localhost'], ConnectionType::ControlUser);