Merge pull request #19567 from MauricioFauth/phpunit-11

Upgrade PHPUnit to version 11.5
This commit is contained in:
Maurício Meneghini Fauth 2025-01-30 12:45:46 -03:00 committed by GitHub
commit 86d238d934
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 380 additions and 315 deletions

View File

@ -20,12 +20,12 @@ jobs:
fail-fast: false
matrix:
include:
- { php-version: '82', experimental: false, arch: 'amd64', exclude-phpunit-groups: 'extension-iconv' }
- { php-version: '82', experimental: false, arch: 'arm64/v8', exclude-phpunit-groups: 'extension-iconv' }
- { php-version: '82', experimental: false, arch: 'arm/v7', exclude-phpunit-groups: 'extension-iconv,32bit-incompatible' }
- { php-version: '82', experimental: false, arch: 'i386', exclude-phpunit-groups: 'extension-iconv,32bit-incompatible' }
- { php-version: '82', experimental: true, arch: 'ppc64le', exclude-phpunit-groups: 'extension-iconv' }
- { php-version: '82', experimental: false, arch: 's390x', exclude-phpunit-groups: 'extension-iconv,32bit-incompatible' }
- { php-version: '82', experimental: false, arch: 'amd64', exclude-phpunit-groups: '--exclude-group extension-iconv' }
- { php-version: '82', experimental: false, arch: 'arm64/v8', exclude-phpunit-groups: '--exclude-group extension-iconv' }
- { php-version: '82', experimental: false, arch: 'arm/v7', exclude-phpunit-groups: '--exclude-group extension-iconv --exclude-group 32bit-incompatible' }
- { php-version: '82', experimental: false, arch: 'i386', exclude-phpunit-groups: '--exclude-group extension-iconv --exclude-group 32bit-incompatible' }
- { php-version: '82', experimental: true, arch: 'ppc64le', exclude-phpunit-groups: '--exclude-group extension-iconv' }
- { php-version: '82', experimental: false, arch: 's390x', exclude-phpunit-groups: '--exclude-group extension-iconv --exclude-group 32bit-incompatible' }
steps:
- name: Checkout code
uses: actions/checkout@v4
@ -48,7 +48,7 @@ jobs:
composer config version "$(php -r "define('VERSION_SUFFIX', ''); require_once('src/Version.php'); echo \PhpMyAdmin\Version::VERSION;")" && \
composer install && \
./bin/generate-mo && \
php\$V -d memory_limit=512M ./vendor/bin/phpunit --no-logging --no-coverage --testsuite unit --exclude-group=%s" \
php\$V -d memory_limit=512M ./vendor/bin/phpunit --no-logging --no-coverage --testsuite unit %s" \
"${{ matrix.php-version }}" "${{ matrix.exclude-phpunit-groups }}" > ./do-tests.sh
- name: Set up multi arch support

View File

@ -113,13 +113,13 @@
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^10.4",
"phpunit/phpunit": "^11.5",
"pragmarx/google2fa-qrcode": "^3.0",
"psalm/plugin-phpunit": "^0.19",
"roave/security-advisories": "dev-latest",
"symfony/console": "^7.1",
"tecnickcom/tcpdf": "^6.4.4",
"vimeo/psalm": "^6",
"vimeo/psalm": "^6.0",
"web-auth/webauthn-lib": "^4.9"
},
"extra": {

589
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -17196,6 +17196,15 @@ 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
@ -17280,6 +17289,15 @@ 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
@ -17815,7 +17833,7 @@ parameters:
path: tests/unit/Controllers/Database/StructureControllerTest.php
-
message: '#^Parameter \#2 \$array of static method PHPUnit\\Framework\\Assert\:\:assertArrayNotHasKey\(\) expects array\|ArrayAccess, mixed given\.$#'
message: '#^Parameter \#2 \$array of static method PHPUnit\\Framework\\Assert\:\:assertArrayNotHasKey\(\) expects array\<mixed\>\|ArrayAccess\<\(int\|string\), mixed\>, mixed given\.$#'
identifier: argument.type
count: 1
path: tests/unit/Controllers/Database/StructureControllerTest.php
@ -18631,7 +18649,7 @@ parameters:
path: tests/unit/CoreTest.php
-
message: '#^Parameter \#2 \$array of static method PHPUnit\\Framework\\Assert\:\:assertArrayNotHasKey\(\) expects array\|ArrayAccess, mixed given\.$#'
message: '#^Parameter \#2 \$array of static method PHPUnit\\Framework\\Assert\:\:assertArrayNotHasKey\(\) expects array\<mixed\>\|ArrayAccess\<\(int\|string\), mixed\>, mixed given\.$#'
identifier: argument.type
count: 9
path: tests/unit/CoreTest.php
@ -18798,6 +18816,15 @@ 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
@ -20518,7 +20545,7 @@ parameters:
path: tests/unit/UtilTest.php
-
message: '#^Parameter \#2 \$array of static method PHPUnit\\Framework\\Assert\:\:assertArrayNotHasKey\(\) expects array\|ArrayAccess, mixed given\.$#'
message: '#^Parameter \#2 \$array of static method PHPUnit\\Framework\\Assert\:\:assertArrayNotHasKey\(\) expects array\<mixed\>\|ArrayAccess\<\(int\|string\), mixed\>, mixed given\.$#'
identifier: argument.type
count: 2
path: tests/unit/UtilTest.php
@ -20596,7 +20623,7 @@ parameters:
path: tests/unit/Utils/SessionCacheTest.php
-
message: '#^Parameter \#2 \$array of static method PHPUnit\\Framework\\Assert\:\:assertArrayNotHasKey\(\) expects array\|ArrayAccess, mixed given\.$#'
message: '#^Parameter \#2 \$array of static method PHPUnit\\Framework\\Assert\:\:assertArrayNotHasKey\(\) expects array\<mixed\>\|ArrayAccess\<\(int\|string\), mixed\>, mixed given\.$#'
identifier: argument.type
count: 2
path: tests/unit/Utils/SessionCacheTest.php

View File

@ -9859,6 +9859,9 @@
</PossiblyUnusedMethod>
</file>
<file src="tests/unit/Advisory/RulesTest.php">
<DeprecatedMethod>
<code><![CDATA[self::assertContainsOnly('string', $rule)]]></code>
</DeprecatedMethod>
<PossiblyUnusedMethod>
<code><![CDATA[providerForTestRules]]></code>
</PossiblyUnusedMethod>
@ -9891,6 +9894,13 @@
<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>
@ -11148,6 +11158,7 @@
<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

@ -19,18 +19,14 @@ use PhpMyAdmin\Tests\FieldHelper;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use PhpMyAdmin\ZipExtension;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\PreserveGlobalState;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use ReflectionProperty;
use ZipArchive;
use function file_put_contents;
use function function_exists;
use function htmlspecialchars;
use function tempnam;
use function unlink;
use function xdebug_get_headers;
use const ENT_COMPAT;
use const MYSQLI_NUM_FLAG;
@ -362,8 +358,6 @@ final class ExportControllerTest extends AbstractTestCase
self::assertStringContainsString(htmlspecialchars($expectedOutput, ENT_COMPAT), $output);
}
#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
public function testDownloadFile(): void
{
$config = new Config();
@ -514,20 +508,8 @@ final class ExportControllerTest extends AbstractTestCase
self::assertStringEndsWith($expected, $output);
$dbiDummy->assertAllQueriesConsumed();
if (! function_exists('xdebug_get_headers')) {
return;
}
$headersList = xdebug_get_headers();
self::assertContains('Content-Description: File Transfer', $headersList);
self::assertContains('Content-Disposition: attachment; filename="test_table.sql"', $headersList);
self::assertContains('Content-type: text/x-sql;charset=UTF-8', $headersList);
self::assertContains('Content-Transfer-Encoding: binary', $headersList);
}
#[RunInSeparateProcess]
#[PreserveGlobalState(false)]
#[RequiresPhpExtension('zip')]
public function testDownloadFileWithCompression(): void
{
@ -690,15 +672,5 @@ final class ExportControllerTest extends AbstractTestCase
unset($zipExtension);
self::assertTrue(unlink($tmpFile));
if (! function_exists('xdebug_get_headers')) {
return;
}
$headersList = xdebug_get_headers();
self::assertContains('Content-Description: File Transfer', $headersList);
self::assertContains('Content-Disposition: attachment; filename="test_table.sql.zip"', $headersList);
self::assertContains('Content-Type: application/zip', $headersList);
self::assertContains('Content-Transfer-Encoding: binary', $headersList);
}
}

View File

@ -13,13 +13,8 @@ use PhpMyAdmin\Http\Factory\ServerRequestFactory;
use PhpMyAdmin\Tests\AbstractTestCase;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use function function_exists;
use function xdebug_get_headers;
#[CoversClass(SchemaExportController::class)]
#[RunTestsInSeparateProcesses]
final class SchemaExportControllerTest extends AbstractTestCase
{
public function testExport(): void
@ -40,14 +35,5 @@ final class SchemaExportControllerTest extends AbstractTestCase
self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode());
self::assertSame('file data', (string) $response->getBody());
if (! function_exists('xdebug_get_headers')) {
return;
}
$headersList = xdebug_get_headers();
self::assertContains('Content-Disposition: attachment; filename="file.svg"', $headersList);
self::assertContains('Content-Type: image/svg+xml', $headersList);
self::assertContains('Content-Length: 9', $headersList);
}
}