Skip to content

Commit

Permalink
Merge pull request phpmyadmin#19584 from MauricioFauth/phpunit-12-dep…
Browse files Browse the repository at this point in the history
…recations

Fix PHPUnit 12 deprecations
  • Loading branch information
MauricioFauth authored Jan 30, 2025
2 parents 07db8a5 + 72a07c3 commit b0d985c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 43 deletions.
27 changes: 0 additions & 27 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Advisory/RulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testRules(callable $rulesFactory): void
self::assertArrayHasKey('issue', $rule);
self::assertArrayHasKey('recommendation', $rule);
self::assertArrayHasKey('justification', $rule);
self::assertContainsOnly('string', $rule);
self::assertContainsOnlyString($rule);
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/CharsetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function testGetCollationsWithIS(): void
$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);
}
Expand All @@ -106,7 +106,7 @@ public function testGetCollationsMariaDB(): void
$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);
}
Expand All @@ -130,7 +130,7 @@ public function testGetCollationsWithoutIS(): void

$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);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/DatabaseInterfaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ public function testExecuteQuery(): void
$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);
Expand Down

0 comments on commit b0d985c

Please sign in to comment.