diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 228c91c193..774a2a3dba 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -13136,13 +13136,15 @@ - - testAddRule - testAddRule - testAddRule - testAdvisorBytime - testAdvisorBytime - + + advisorTimes + rulesProvider + + + + + providerForTestRules + @@ -13153,14 +13155,14 @@ - - testCacheGet - testCacheGetDefaultValue - testCacheHas - testCachePurge - testCacheRemove - testCacheSet - + + dataProviderCacheKeyValues + + + + + providerTestBuildDescription + @@ -13176,11 +13178,10 @@ - - testGetGeneratedClassInvalidVersion - testGetGeneratedClassValidVersion - testGetGeneratedClassValidVersion - + + dataProviderBadVersions + dataProviderGoodVersions + @@ -13236,6 +13237,9 @@ $second + + getValues + @@ -13265,6 +13269,9 @@ , class-string}}]]> + + formObjects + @@ -13293,6 +13300,174 @@ sessionID]]> + + + booleanWithDefaultFalseProvider + booleanWithDefaultTrueProvider + valuesForHeightProvider + valuesForModeProvider + valuesForOrderByProvider + valuesForOrderProvider + + + + + booleanWithDefaultFalseProvider + + + + + booleanWithDefaultFalseProvider + booleanWithDefaultTrueProvider + structureOrDataWithDefaultDataProvider + structureOrDataWithDefaultStructureOrDataProvider + valuesForCharsetProvider + valuesForCodegenFormatProvider + valuesForCompressionProvider + valuesForCsvEnclosedProvider + valuesForCsvEscapedProvider + valuesForCsvNullProvider + valuesForCsvSeparatorProvider + valuesForCsvTerminatedProvider + valuesForExcelEditionProvider + valuesForExcelNullProvider + valuesForFileTemplateDatabaseProvider + valuesForFileTemplateServerProvider + valuesForFileTemplateTableProvider + valuesForFormatProvider + valuesForHtmlwordNullProvider + valuesForLatexDataCaptionProvider + valuesForLatexDataContinuedCaptionProvider + valuesForLatexDataLabelProvider + valuesForLatexNullProvider + valuesForLatexStructureCaptionProvider + valuesForLatexStructureContinuedCaptionProvider + valuesForLatexStructureLabelProvider + valuesForMethodProvider + valuesForOdsNullProvider + valuesForOdtNullProvider + valuesForPdfReportTitleProvider + valuesForSqlCompatibilityProvider + valuesForSqlHeaderCommentProvider + valuesForSqlInsertSyntaxProvider + valuesForSqlMaxQuerySizeProvider + valuesForSqlTypeProvider + valuesForTexytextNullProvider + + + + + booleanWithDefaultFalseProvider + booleanWithDefaultTrueProvider + valuesForCharsetProvider + valuesForCsvColumnsProvider + valuesForCsvEnclosedProvider + valuesForCsvEscapedProvider + valuesForCsvNewLineProvider + valuesForCsvTerminatedProvider + valuesForFormatProvider + valuesForLdiColumnsProvider + valuesForLdiEnclosedProvider + valuesForLdiEscapedProvider + valuesForLdiLocalOptionProvider + valuesForLdiNewLineProvider + valuesForLdiTerminatedProvider + valuesForSkipQueriesProvider + valuesForSqlCompatibilityProvider + + + + + providerForTestConstructor + + + + + booleanWithDefaultFalseProvider + booleanWithDefaultTrueProvider + valuesForAllowDenyProvider + valuesForAuthHttpRealmProvider + valuesForAuthTypeProvider + valuesForConfigStorageTablesProvider + valuesForControlCompressProvider + valuesForControlHideConnectionErrorsProvider + valuesForControlHostProvider + valuesForControlPassProvider + valuesForControlPortProvider + valuesForControlSocketProvider + valuesForControlSslProvider + valuesForControlSslVerifyProvider + valuesForControlUserProvider + valuesForHideDbProvider + valuesForHostProvider + valuesForLogoutURLProvider + valuesForMaxTableUiPrefsProvider + valuesForOnlyDbProvider + valuesForPasswordProvider + valuesForPmaDbProvider + valuesForPortProvider + valuesForSessionTimeZoneProvider + valuesForSignonCookieParamsProvider + valuesForSignonScriptProvider + valuesForSignonSessionProvider + valuesForSignonURLProvider + valuesForSocketProvider + valuesForSslOptionsProvider + valuesForTrackingDefaultStatementsProvider + valuesForUserProvider + valuesForVerboseProvider + + + + + booleanWithDefaultTrueProvider + + + + + valuesForBool2TextProvider + valuesForDateFormatProvider + valuesForExternalProvider + valuesForHexProvider + valuesForInlineProvider + valuesForPreApPendProvider + valuesForSubstringProvider + valuesForTextImageLinkProvider + valuesForTextLinkProvider + + + + + booleanWithDefaultFalseProvider + booleanWithDefaultTrueProvider + providerForTestConstructor + valuesForAllowThirdPartyFramingProvider + valuesForAuthLogProvider + valuesForBlowfishSecretProvider + valuesForExecTimeLimitProvider + valuesForLimitCharsProvider + valuesForMaxCharactersInDisplayedSQLProvider + valuesForMaxDbListProvider + valuesForMaxRowsProvider + valuesForMaxTableListProvider + valuesForMysqlMinVersionProvider + valuesForOBGzipProvider + valuesForPmaAbsoluteUriProvider + valuesForProxyPassProvider + valuesForProxyUrlProvider + valuesForProxyUserProvider + valuesForRepeatCellsProvider + valuesForServerDefaultProvider + valuesForServersProvider + valuesForSessionSavePathProvider + valuesForTranslationWarningThresholdProvider + + + + + providerForTestToArray + + assertSame @@ -13302,6 +13477,9 @@ $_SESSION $_SESSION + + providerForTestRenameTable + assertSame assertSame @@ -13332,13 +13510,16 @@ - - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - + + configPaths + connectionParams + connectionParamsWhenConnectionIsUserOrAuxiliaryProvider + httpsParams + rootUris + selectServerProvider + serverNames + userAgentProvider + @@ -13402,6 +13583,11 @@ [$currentTable] + + + providerForTestValidateGisData + + $responseMessage @@ -13412,6 +13598,11 @@ $responseMessage + + + providerForTestDefault + + @@ -13496,6 +13687,66 @@ expects + + + providerForTestNoTableSelected + + + + + providerForTestNoTableSelected + + + + + providerForTestNoTableSelected + + + + + providerForTestNoTableSelected + + + + + providerForTestNoTableSelected + + + + + providerForTestInvalidDatabaseAndTable + + + + + providerForTestInvalidDatabaseAndTable + + + + + providerForTestInvalidDatabaseAndTable + + + + + providerForTestInvalidDatabaseAndTable + + + + + providerForTestInvalidDatabaseAndTable + + + + + providerForTestInvalidDatabaseAndTable + + + + + providerForTestInvalidDatabaseAndTable + + method @@ -13524,11 +13775,12 @@ expects + + + providerForTestWithoutTheme + + - - testPopulateRequestWithEncryptedQueryParamsWithInvalidParam - testPopulateRequestWithEncryptedQueryParamsWithInvalidParam - @@ -13568,6 +13820,23 @@ + + provideTestIsAllowedDomain + provideTestSafeUnserialize + provideTestSanitizeMySQLHost + providerForTestPopulateRequestWithEncryptedQueryParamsWithInvalidParam + providerTestGetRealSize + providerTestGotoNowhere + providerTestLinkURL + + + + + providerGetColumnCreationQueryRequest + providerGetNumberOfFieldsFromRequest + providerGetPartitionsDefinition + providerGetTableCreationQuery + @@ -13642,33 +13911,63 @@ $result + + + providerGetDataFromRequest + providerGetEditorFormAdd + providerGetEditorFormAjax + providerGetEditorFormEdit + providerGetQueryFromRequest + + $_POST[$key] $_REQUEST[$key] $value + + providerGetDataFromRequest + providerGetEditorForm1 + providerGetEditorForm2 + providerGetEditorForm3 + providerGetEditorForm4 + providerGetExecuteForm1 + providerGetExecuteForm2 + providerGetParameterRow + providerGetParameterRowAjax + providerGetQueryFromRequest + + + + + searchTypes + - - mixed[] - mixed[] - - - testFormatError - testFormatError - testFormatError - testVersion - testVersion - testVersion - testVersion - + + currentUserData + errorData + isAmazonRdsData + provideDatabaseVersionData + providerForTestGetLowerCaseNames + versionData + escapeString escapeString + + errorData + schemaData + + + + + providerForTestWarning + @@ -13723,53 +14022,48 @@ $output $output - - mixed[] - mixed[] - mixed[] - - - testGetSortOrderHiddenInputs - testGetSortOrderHiddenInputs - testGetSortOrderHiddenInputs - testGetSortOrderHiddenInputs - testGetSortOrderHiddenInputs - testSetConfigParamsForDisplayTable - testSetConfigParamsForDisplayTable - testSetConfigParamsForDisplayTable - testSetConfigParamsForDisplayTable - testSetConfigParamsForDisplayTable - + + dataProviderForTestGetDataCellForNonNumericColumns + dataProviderForTestGetPartialText + dataProviderForTestGetRowInfoForSpecialLinks + dataProviderForTestGetSpecialLinkUrl + dataProviderForTestHandleNonPrintableContents + dataProviderGetSortOrderHiddenInputs + dataProviderSortOrder + providerSetConfigParamsForDisplayTable + - - mixed[] - + + providerFortTestResolveTypeSize + $_SESSION + + providerForTestHandleError + assertIsString - - testSanitizeUrl - testSanitizeUrl - + + urlsToSanitize + - - mixed[] - + + filePathProvider + @@ -13784,6 +14078,11 @@ + + + compressedFiles + + $_SESSION @@ -13817,9 +14116,27 @@ - - testGetPointOnSurface - + + providerForIsOuterRing + providerForTestArea + providerForTestGetPointOnSurface + providerForTestIsPointInsidePolygon + + + + + providerForTestFactory + + + + + providerForPrepareRowAsOl + providerForPrepareRowAsPdf + providerForPrepareRowAsSvg + providerForTestGenerateParams + providerForTestGenerateWkt + providerForTestScaleRow + @@ -13828,12 +14145,77 @@ $points + + providerForTestExtractPointsInternal + providerForTestParseWktAndSrid + providerForTestSetMinMax + + + + + providerForPrepareRowAsOl + providerForPrepareRowAsPdf + providerForPrepareRowAsSvg + providerForTestGenerateParams + providerForTestGenerateWkt + providerForTestScaleRow + + + + + providerForPrepareRowAsOl + providerForPrepareRowAsPdf + providerForPrepareRowAsSvg + providerForTestGenerateParams + providerForTestGenerateWkt + providerForTestScaleRow + + + + + providerForPrepareRowAsOl + providerForPrepareRowAsPdf + providerForPrepareRowAsSvg + providerForTestGenerateParams + providerForTestGenerateWkt + providerForTestScaleRow + + + + + providerForPrepareRowAsOl + providerForPrepareRowAsPdf + providerForPrepareRowAsSvg + providerForTestGenerateParams + providerForTestGenerateWkt + providerForTestGetShape + providerForTestScaleRow + + + + + providerForPrepareRowAsOl + providerForPrepareRowAsPdf + providerForPrepareRowAsSvg + providerForTestGenerateParams + providerForTestGenerateWkt + providerForTestGetShape + providerForTestScaleRow + + + providerForPrepareRowAsOl + providerForPrepareRowAsPdf + providerForPrepareRowAsSvg + providerForTestGenerateParams + providerForTestGenerateWkt + providerForTestScaleRow + @@ -13850,17 +14232,9 @@ - - testGetHttpHeaders - testGetHttpHeaders - testGetHttpHeaders - testGetHttpHeaders - testGetHttpHeaders - testGetHttpHeaders - testGetHttpHeaders - testGetHttpHeaders - testGetHttpHeaders - + + providerForTestGetHttpHeaders + (string) gmdate(DATE_RFC1123) @@ -13869,9 +14243,10 @@ $result - - mixed[] - + + linksOrButtons + providerForTestGetDefaultFunctionForField + @@ -13885,18 +14260,43 @@ new $className() - - testPsr7ImplementationCreateServerRequestFactory - testPsr7ImplementationCreateServerRequestFactory - testPsr7ImplementationGet - testPsr7ImplementationGet - + + dataProviderPsr7Implementations + GuzzleHttpFactory LaminasServerRequestFactory NyholmPsr17Factory + + + providerForTestGetRoute + + + + + providerForTestInvalidNames + providerForTestValidNames + + + + + providerForTestInvalidNames + providerForTestValidNames + + + + + providerForTestInvalidNames + providerForTestValidNames + + + + + providerForTestGetMatchedRows + + assertSame @@ -13906,18 +14306,15 @@ assertSame assertSame - - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - - - testSkipByteOrderMarksFromContents - testSkipByteOrderMarksFromContents - + + provDetectType + provGetColumnAlphaName + provGetColumnNumberFromName + provGetDecimalPrecision + provGetDecimalScale + provGetDecimalSize + providerContentWithByteOrderMarks + assertNull assertNull @@ -13967,6 +14364,10 @@ $result $result + + dataProviderConfigValueInsertRows + providerForTestGetSpecialCharsForInsertingMode + @@ -13979,30 +14380,36 @@ - - mixed[] - + + proxyIPs + - - mixed[] - + + listLocales + selectDataProvider + + + + + lintProvider + - - mixed[] - mixed[] - mixed[] - mixed[] - + + decodeBBDataProvider + providerAffectedRows + providerDeletedRows + providerInsertedRows + - - mixed[] - + + providerForTestDetect + @@ -14010,9 +14417,9 @@ - - mixed[] - + + providerForTestIcon + @@ -14027,6 +14434,22 @@ assertNotFalse + + + providerGetPartitionMaintenanceChoices + + + + + providerForTestHavePartitioning + + + + + providerGetDetails + providerGetDetailsWithMaxPartitions + + getPDFData()]]> @@ -14045,14 +14468,24 @@ $result - - mixed[] - mixed[] - + + checkRulesProvider + dataProviderPasswordLength + assertIsString + + + readCredentialsProvider + + + + + providerForTestValidPlugins + + $result @@ -14122,12 +14555,12 @@ - - mixed[] - mixed[] - mixed[] - mixed[] - + + getDotNetObjectTypeProvider + getDotNetPrimitiveTypeProvider + isNotNullProvider + isUniqueProvider + @@ -14163,9 +14596,9 @@ - - mixed[] - + + dataProviderOdsEmptyRows + @@ -14192,9 +14625,10 @@ - - testTransformation - + + multiDataProvider + transformationDataProvider + @@ -14219,6 +14653,9 @@ + + providerForTestGetDefault + assertIsArray assertIsArray @@ -14250,12 +14687,23 @@ getMockForAbstractClass + + + providerForTestHasAccountLocking + providerForTestIsUUIDSupported + + + + + providerForTestCleanupPathInfo + + - - mixed[] - mixed[] - mixed[] - + + dataProviderCheckLinks + docLinks + variables + @@ -14286,6 +14734,9 @@ getMessage getMessage + + providerUnEscapeMysqlWildcards + $password $routinename @@ -14300,10 +14751,14 @@ - - testRender - testRender - + + renderDataProvider + + + + + sysInfoOsProvider + @@ -14321,22 +14776,17 @@ $result - - testCountQueryResults - testCountQueryResults - testCountQueryResults - testCountQueryResults - testCountQueryResults - testCountQueryResults - + + dataProviderCountQueryResults + getMockForAbstractClass - - mixed[] - + + providerGetEngine + @@ -14354,6 +14804,11 @@ $value + + + providerColumnMetaDefault + + @@ -14366,6 +14821,11 @@ expects + + + providerForTestFromArray + + @@ -14383,6 +14843,9 @@ will will + + dataValidateName + expects expects @@ -14390,12 +14853,12 @@ - - mixed[] - mixed[] - mixed[] - mixed[] - + + providerTestDynamicRender + providerTestRender + providerTestRenderGettext + providerTestSet + @@ -14409,14 +14872,14 @@ backup]]> - - mixed[] - + + providerForGetImgPath + - - mixed[] - + + parseQueryData + @@ -14428,25 +14891,36 @@ - - mixed[] - $data[0] $fetchArrayReturn[0] + + getTrackedDataProvider + - - testFixup - testFixup - testGetDescription - testGetDescription - testGetName - testGetName - testGetOptions - testGetOptions - + + fixupData + getOptionsData + providerGetDescription + providerGetName + + + + + arrayWithInvalidValuesProvider + arrayWithValidValuesProvider + + + + + providerGetDataFromRequestEmpty + providerGetEditorFormAdd + providerGetEditorFormAjax + providerGetEditorFormEdit + providerGetQueryFromRequest + @@ -14454,10 +14928,24 @@ config['settings']['secret']]]> + + + providerFortTestGetAllFunctions + providerFortTestGetColumns + providerFortTestGetFunctions + providerFortTestGetFunctionsClass + + + + + providerForGetTypeOperators + providerForTestGetTypeDescription + providerForTestGetTypeOperatorsHtml + providerFortTestGetFunctionsClass + providerFortTestGetTypeClass + + - - testSetChangePasswordMsg - array{0: bool, 1: Message, 2: string, 3: string, 4: string}[] + + providerSetChangePasswordMsg + @@ -14489,9 +14980,6 @@ - - testGetMySQLDocuURL - - - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - mixed[] - - - testBackquote - testBackquote - testGetScriptNameForOption - testGetScriptNameForOption - testGetScriptNameForOption - + + charsetQueryData + dataProviderScriptNames + provideForTestIsUUIDSupported + providerConvertBitDefaultValue + providerDuplicateFirstNewline + providerExpandUserString + providerExtractColumnSpec + providerExtractValueFromFormattedSize + providerForTestBackquote + providerForTestGetLowerCaseNames + providerForTestGetMySQLDocuURL + providerFormatByteDown + providerFormatNumber + providerForwardedHeaders + providerGetFormattedMaximumUploadSize + providerGetTitleForTarget + providerGetUniqueConditionForGroupFlag + providerIsInteger + providerLocalisedDate + providerPrintableBitValue + providerTimespanFormat + providerUnQuote + providerUnQuoteSelectedChar + providerUserDir + - - mixed[] - - - testHandleDisableCheckCleanup - testHandleDisableCheckCleanup - testHandleDisableCheckInit - testHandleDisableCheckInit - testHandleDisableCheckInitVarFalse - testHandleDisableCheckInitVarFalse - + + providerCheckCleanup + providerCheckInit + providerIsSupported + - - mixed[] - mixed[] - mixed[] - + + providerBinaryToIp + providerIpToBinary + providerIpToLong + providerLongToIp + - - testConvertToWellKnownText - testConvertToWellKnownText - testConvertToWellKnownText - testConvertToWellKnownText - testConvertToWellKnownText - + + providerConvertToWellKnownText + @@ -14619,28 +15098,9 @@ - - testCreate - testCreate - testCreate - testCreate - testCurl - testCurl - testCurl - testCurl - testCurlCAInfo - testCurlCAInfo - testCurlCAInfo - testCurlCAInfo - testCurlCAPath - testCurlCAPath - testCurlCAPath - testCurlCAPath - testFopen - testFopen - testFopen - testFopen - + + httpRequests + $curl !== false $curl !== false @@ -14673,9 +15133,22 @@ - - mixed[] - + + dataProviderVersionConditions + dataVersions + + + + + dataProviderForTestDecode + indefiniteLengthValuesProvider + + + + + provideTestFindFile + provideTestGetContents + @@ -14685,6 +15158,11 @@ $sqlMode + + + exportDataProvider + + diff --git a/test/classes/Advisory/AdvisorTest.php b/test/classes/Advisory/AdvisorTest.php index 7f76e73464..2a231239f5 100644 --- a/test/classes/Advisory/AdvisorTest.php +++ b/test/classes/Advisory/AdvisorTest.php @@ -6,9 +6,11 @@ namespace PhpMyAdmin\Tests\Advisory; use PhpMyAdmin\Advisory\Advisor; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -/** @covers \PhpMyAdmin\Advisory\Advisor */ +#[CoversClass(Advisor::class)] class AdvisorTest extends AbstractTestCase { protected function setUp(): void @@ -26,9 +28,8 @@ class AdvisorTest extends AbstractTestCase * * @param float $time time * @param string $expected expected result - * - * @dataProvider advisorTimes */ + #[DataProvider('advisorTimes')] public function testAdvisorBytime(float $time, string $expected): void { $result = Advisor::byTime($time, 2); @@ -53,9 +54,8 @@ class AdvisorTest extends AbstractTestCase * @param mixed[] $rule Rule to test * @param mixed[] $expected Expected rendered rule in fired/errors list * @param string|null $error Expected error string (null if none error expected) - * - * @dataProvider rulesProvider */ + #[DataProvider('rulesProvider')] public function testAddRule(array $rule, array $expected, string|null $error): void { parent::setLanguage(); diff --git a/test/classes/Advisory/RulesTest.php b/test/classes/Advisory/RulesTest.php index 8e17077f20..c107b62a39 100644 --- a/test/classes/Advisory/RulesTest.php +++ b/test/classes/Advisory/RulesTest.php @@ -5,19 +5,16 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Advisory; use PhpMyAdmin\Advisory\Rules; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** - * @covers \PhpMyAdmin\Advisory\Rules - * @psalm-import-type RuleType from Rules - */ +/** @psalm-import-type RuleType from Rules */ +#[CoversClass(Rules::class)] class RulesTest extends TestCase { - /** - * @psalm-param callable(): list $rulesFactory - * - * @dataProvider providerForTestRules - */ + /** @psalm-param callable(): list $rulesFactory */ + #[DataProvider('providerForTestRules')] public function testRules(callable $rulesFactory): void { $rules = $rulesFactory(); diff --git a/test/classes/BookmarkTest.php b/test/classes/BookmarkTest.php index 8e5bbda7b9..7560979306 100644 --- a/test/classes/BookmarkTest.php +++ b/test/classes/BookmarkTest.php @@ -10,8 +10,9 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Identifiers\TableName; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Bookmark */ +#[CoversClass(Bookmark::class)] class BookmarkTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/BrowseForeignersTest.php b/test/classes/BrowseForeignersTest.php index 3e307bcc7d..b74a7d8ba4 100644 --- a/test/classes/BrowseForeignersTest.php +++ b/test/classes/BrowseForeignersTest.php @@ -7,8 +7,9 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\BrowseForeigners; use PhpMyAdmin\Config; use PhpMyAdmin\Template; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\BrowseForeigners */ +#[CoversClass(BrowseForeigners::class)] class BrowseForeignersTest extends AbstractTestCase { private BrowseForeigners $browseForeigners; diff --git a/test/classes/CacheTest.php b/test/classes/CacheTest.php index 04f707e912..f2edf0161f 100644 --- a/test/classes/CacheTest.php +++ b/test/classes/CacheTest.php @@ -5,9 +5,11 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Cache; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use stdClass; -/** @covers \PhpMyAdmin\Cache */ +#[CoversClass(Cache::class)] class CacheTest extends AbstractTestCase { public function setUp(): void @@ -25,7 +27,7 @@ class CacheTest extends AbstractTestCase ]; } - /** @dataProvider dataProviderCacheKeyValues */ + #[DataProvider('dataProviderCacheKeyValues')] public function testCacheHas(string $cacheKey, mixed $valueToCache): void { $this->assertFalse(Cache::has($cacheKey)); @@ -35,7 +37,7 @@ class CacheTest extends AbstractTestCase $this->assertFalse(Cache::has($cacheKey)); } - /** @dataProvider dataProviderCacheKeyValues */ + #[DataProvider('dataProviderCacheKeyValues')] public function testCachePurge(string $cacheKey, mixed $valueToCache): void { $this->assertFalse(Cache::has($cacheKey)); @@ -45,7 +47,7 @@ class CacheTest extends AbstractTestCase $this->assertFalse(Cache::has($cacheKey)); } - /** @dataProvider dataProviderCacheKeyValues */ + #[DataProvider('dataProviderCacheKeyValues')] public function testCacheSet(string $cacheKey, mixed $valueToCache): void { $this->assertFalse(Cache::has($cacheKey)); @@ -53,7 +55,7 @@ class CacheTest extends AbstractTestCase $this->assertTrue(Cache::has($cacheKey)); } - /** @dataProvider dataProviderCacheKeyValues */ + #[DataProvider('dataProviderCacheKeyValues')] public function testCacheGet(string $cacheKey, mixed $valueToCache): void { $this->assertFalse(Cache::has($cacheKey)); @@ -62,7 +64,7 @@ class CacheTest extends AbstractTestCase $this->assertSame(Cache::get($cacheKey), $valueToCache); } - /** @dataProvider dataProviderCacheKeyValues */ + #[DataProvider('dataProviderCacheKeyValues')] public function testCacheGetDefaultValue(string $cacheKey, mixed $valueToCache): void { $this->assertFalse(Cache::has($cacheKey)); @@ -77,7 +79,7 @@ class CacheTest extends AbstractTestCase $this->assertFalse(Cache::get($cacheKey, false)); } - /** @dataProvider dataProviderCacheKeyValues */ + #[DataProvider('dataProviderCacheKeyValues')] public function testCacheRemove(string $cacheKey, mixed $valueToCache): void { $this->assertFalse(Cache::has($cacheKey)); diff --git a/test/classes/Charsets/CharsetTest.php b/test/classes/Charsets/CharsetTest.php index 83d9f05660..413537420f 100644 --- a/test/classes/Charsets/CharsetTest.php +++ b/test/classes/Charsets/CharsetTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Charsets; use PhpMyAdmin\Charsets\Charset; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Charsets\Charset */ +#[CoversClass(Charset::class)] class CharsetTest extends AbstractTestCase { public function testFromServer(): void diff --git a/test/classes/Charsets/CollationTest.php b/test/classes/Charsets/CollationTest.php index 1b36129296..c5daf921ba 100644 --- a/test/classes/Charsets/CollationTest.php +++ b/test/classes/Charsets/CollationTest.php @@ -6,8 +6,10 @@ namespace PhpMyAdmin\Tests\Charsets; use PhpMyAdmin\Charsets\Collation; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Charsets\Collation */ +#[CoversClass(Collation::class)] class CollationTest extends AbstractTestCase { public function testFromServer(): void @@ -40,9 +42,8 @@ class CollationTest extends AbstractTestCase * * @param string $collation Collation for which description is reqd * @param string $description Expected Description - * - * @dataProvider providerTestBuildDescription */ + #[DataProvider('providerTestBuildDescription')] public function testBuildDescription(string $collation, string $description): void { $actual = Collation::fromServer(['Collation' => $collation]); diff --git a/test/classes/CharsetsTest.php b/test/classes/CharsetsTest.php index a82350d725..eb589c55d5 100644 --- a/test/classes/CharsetsTest.php +++ b/test/classes/CharsetsTest.php @@ -5,12 +5,13 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Charsets; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; -/** - * @covers \PhpMyAdmin\Charsets - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ +#[CoversClass(Charsets::class)] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] class CharsetsTest extends AbstractTestCase { public function testGetServerCharset(): void diff --git a/test/classes/CheckUserPrivilegesTest.php b/test/classes/CheckUserPrivilegesTest.php index 0dc2a11abd..abd2b522f4 100644 --- a/test/classes/CheckUserPrivilegesTest.php +++ b/test/classes/CheckUserPrivilegesTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\CheckUserPrivileges; use PhpMyAdmin\ShowGrants; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\CheckUserPrivileges */ +#[CoversClass(CheckUserPrivileges::class)] class CheckUserPrivilegesTest extends AbstractTestCase { private CheckUserPrivileges $checkUserPrivileges; diff --git a/test/classes/Command/SetVersionCommandTest.php b/test/classes/Command/SetVersionCommandTest.php index aea682bc07..38aa061031 100644 --- a/test/classes/Command/SetVersionCommandTest.php +++ b/test/classes/Command/SetVersionCommandTest.php @@ -6,13 +6,15 @@ namespace PhpMyAdmin\Tests\Command; use PhpMyAdmin\Command\SetVersionCommand; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use RangeException; use Symfony\Component\Console\Command\Command; use function class_exists; use function sprintf; -/** @covers \PhpMyAdmin\Command\SetVersionCommand */ +#[CoversClass(SetVersionCommand::class)] class SetVersionCommandTest extends AbstractTestCase { private SetVersionCommand $command; @@ -49,7 +51,7 @@ class SetVersionCommandTest extends AbstractTestCase ]; } - /** @dataProvider dataProviderBadVersions */ + #[DataProvider('dataProviderBadVersions')] public function testGetGeneratedClassInvalidVersion(string $version): void { if (! class_exists(Command::class)) { @@ -161,7 +163,7 @@ class SetVersionCommandTest extends AbstractTestCase ]; } - /** @dataProvider dataProviderGoodVersions */ + #[DataProvider('dataProviderGoodVersions')] public function testGetGeneratedClassValidVersion(string $version, string $content): void { if (! class_exists(Command::class)) { diff --git a/test/classes/Command/TwigLintCommandTest.php b/test/classes/Command/TwigLintCommandTest.php index 25342e9202..6208af665c 100644 --- a/test/classes/Command/TwigLintCommandTest.php +++ b/test/classes/Command/TwigLintCommandTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Command; use PhpMyAdmin\Command\TwigLintCommand; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use Symfony\Component\Console\Command\Command; use Twig\Error\SyntaxError; use Twig\Source; @@ -18,7 +19,7 @@ use const SORT_NATURAL; use const SORT_REGULAR; use const TEST_PATH; -/** @covers \PhpMyAdmin\Command\TwigLintCommand */ +#[CoversClass(TwigLintCommand::class)] class TwigLintCommandTest extends AbstractTestCase { private TwigLintCommand $command; diff --git a/test/classes/Command/WriteGitRevisionCommandTest.php b/test/classes/Command/WriteGitRevisionCommandTest.php index dcd89f2d2e..3aa1bd232e 100644 --- a/test/classes/Command/WriteGitRevisionCommandTest.php +++ b/test/classes/Command/WriteGitRevisionCommandTest.php @@ -6,12 +6,13 @@ namespace PhpMyAdmin\Tests\Command; use PhpMyAdmin\Command\WriteGitRevisionCommand; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use Symfony\Component\Console\Command\Command; use function class_exists; use function sprintf; -/** @covers \PhpMyAdmin\Command\WriteGitRevisionCommand */ +#[CoversClass(WriteGitRevisionCommand::class)] class WriteGitRevisionCommandTest extends AbstractTestCase { private WriteGitRevisionCommand $command; diff --git a/test/classes/CommonTest.php b/test/classes/CommonTest.php index 9d9da99a75..6d55d810c9 100644 --- a/test/classes/CommonTest.php +++ b/test/classes/CommonTest.php @@ -5,8 +5,9 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Common; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Common */ +#[CoversClass(Common::class)] class CommonTest extends AbstractTestCase { public function testCheckTokenRequestParam(): void diff --git a/test/classes/Config/ConfigFileTest.php b/test/classes/Config/ConfigFileTest.php index bb92382bd6..f48f832b29 100644 --- a/test/classes/Config/ConfigFileTest.php +++ b/test/classes/Config/ConfigFileTest.php @@ -7,12 +7,14 @@ namespace PhpMyAdmin\Tests\Config; use PhpMyAdmin\Config\ConfigFile; use PhpMyAdmin\Config\Settings; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use stdClass; use function array_keys; use function count; -/** @covers \PhpMyAdmin\Config\ConfigFile */ +#[CoversClass(ConfigFile::class)] class ConfigFileTest extends AbstractTestCase { /** @@ -276,9 +278,8 @@ class ConfigFileTest extends AbstractTestCase /** * Test for ConfigFile::getFlatDefaultConfig - * - * @group medium */ + #[Group('medium')] public function testGetFlatDefaultConfig(): void { $flatDefaultConfig = $this->object->getFlatDefaultConfig(); diff --git a/test/classes/Config/DescriptionTest.php b/test/classes/Config/DescriptionTest.php index dcb9afd3cb..e3520fa562 100644 --- a/test/classes/Config/DescriptionTest.php +++ b/test/classes/Config/DescriptionTest.php @@ -7,15 +7,17 @@ namespace PhpMyAdmin\Tests\Config; use PhpMyAdmin\Config\Descriptions; use PhpMyAdmin\Config\Settings; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use function array_keys; use function in_array; -/** - * @covers \PhpMyAdmin\Config\Descriptions - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ +#[CoversClass(Descriptions::class)] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] class DescriptionTest extends AbstractTestCase { protected function setUp(): void @@ -29,9 +31,8 @@ class DescriptionTest extends AbstractTestCase * @param string $item item * @param string $type type * @param string $expected expected result - * - * @dataProvider getValues */ + #[DataProvider('getValues')] public function testGet(string $item, string $type, string $expected): void { $this->assertEquals($expected, Descriptions::get($item, $type)); diff --git a/test/classes/Config/FormDisplayTemplateTest.php b/test/classes/Config/FormDisplayTemplateTest.php index b1feca9d5f..945a232f3f 100644 --- a/test/classes/Config/FormDisplayTemplateTest.php +++ b/test/classes/Config/FormDisplayTemplateTest.php @@ -7,8 +7,9 @@ namespace PhpMyAdmin\Tests\Config; use PhpMyAdmin\Config; use PhpMyAdmin\Config\FormDisplayTemplate; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Config\FormDisplayTemplate */ +#[CoversClass(FormDisplayTemplate::class)] class FormDisplayTemplateTest extends AbstractTestCase { protected FormDisplayTemplate $formDisplayTemplate; diff --git a/test/classes/Config/FormDisplayTest.php b/test/classes/Config/FormDisplayTest.php index d60e9b873c..58cbd18fa9 100644 --- a/test/classes/Config/FormDisplayTest.php +++ b/test/classes/Config/FormDisplayTest.php @@ -8,6 +8,8 @@ use PhpMyAdmin\Config\ConfigFile; use PhpMyAdmin\Config\Form; use PhpMyAdmin\Config\FormDisplay; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use ReflectionMethod; use ReflectionProperty; @@ -15,7 +17,7 @@ use ReflectionProperty; use function function_exists; use function gettype; -/** @covers \PhpMyAdmin\Config\FormDisplay */ +#[CoversClass(FormDisplay::class)] class FormDisplayTest extends AbstractTestCase { protected FormDisplay $object; @@ -48,9 +50,8 @@ class FormDisplayTest extends AbstractTestCase /** * Test for FormDisplay::registerForm - * - * @group medium */ + #[Group('medium')] public function testRegisterForm(): void { $reflection = new ReflectionClass(FormDisplay::class); @@ -80,9 +81,8 @@ class FormDisplayTest extends AbstractTestCase /** * Test for FormDisplay::process - * - * @group medium */ + #[Group('medium')] public function testProcess(): void { $this->assertFalse( diff --git a/test/classes/Config/FormTest.php b/test/classes/Config/FormTest.php index dadf8e62a7..bfd7557b2f 100644 --- a/test/classes/Config/FormTest.php +++ b/test/classes/Config/FormTest.php @@ -7,13 +7,15 @@ namespace PhpMyAdmin\Tests\Config; use PhpMyAdmin\Config\ConfigFile; use PhpMyAdmin\Config\Form; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use ReflectionProperty; use function array_keys; use function preg_match; -/** @covers \PhpMyAdmin\Config\Form */ +#[CoversClass(Form::class)] class FormTest extends AbstractTestCase { protected Form $object; @@ -50,9 +52,8 @@ class FormTest extends AbstractTestCase /** * Test for Form::__constructor - * - * @group medium */ + #[Group('medium')] public function testContructor(): void { $this->assertEquals(1, $this->object->index); diff --git a/test/classes/Config/Forms/FormListTest.php b/test/classes/Config/Forms/FormListTest.php index 159fa97a77..8e53831e97 100644 --- a/test/classes/Config/Forms/FormListTest.php +++ b/test/classes/Config/Forms/FormListTest.php @@ -8,16 +8,19 @@ use PhpMyAdmin\Config\ConfigFile; use PhpMyAdmin\Config\Forms\BaseForm; use PhpMyAdmin\Config\Forms\BaseFormList; use PhpMyAdmin\Config\Forms\Page; +use PhpMyAdmin\Config\Forms\Page\PageFormList; use PhpMyAdmin\Config\Forms\Setup; +use PhpMyAdmin\Config\Forms\Setup\SetupFormList; use PhpMyAdmin\Config\Forms\User; +use PhpMyAdmin\Config\Forms\User\UserFormList; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** - * @covers \PhpMyAdmin\Config\Forms\BaseFormList - * @covers \PhpMyAdmin\Config\Forms\Page\PageFormList - * @covers \PhpMyAdmin\Config\Forms\Setup\SetupFormList - * @covers \PhpMyAdmin\Config\Forms\User\UserFormList - */ +#[CoversClass(BaseFormList::class)] +#[CoversClass(PageFormList::class)] +#[CoversClass(SetupFormList::class)] +#[CoversClass(UserFormList::class)] class FormListTest extends AbstractTestCase { protected function setUp(): void @@ -36,9 +39,8 @@ class FormListTest extends AbstractTestCase * @param string $prefix Returned class prefix * @psalm-param class-string $class * @psalm-param class-string $prefix - * - * @dataProvider formObjects */ + #[DataProvider('formObjects')] public function testForms(string $class, string $prefix): void { $cf = new ConfigFile($GLOBALS['config']->baseSettings); diff --git a/test/classes/Config/PageSettingsTest.php b/test/classes/Config/PageSettingsTest.php index 5bddce4dd1..f14a3b1cb1 100644 --- a/test/classes/Config/PageSettingsTest.php +++ b/test/classes/Config/PageSettingsTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Config; use PhpMyAdmin\Config\PageSettings; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Config\PageSettings */ +#[CoversClass(PageSettings::class)] class PageSettingsTest extends AbstractTestCase { /** diff --git a/test/classes/Config/ServerConfigChecksTest.php b/test/classes/Config/ServerConfigChecksTest.php index 6f17544a90..839ec3de8d 100644 --- a/test/classes/Config/ServerConfigChecksTest.php +++ b/test/classes/Config/ServerConfigChecksTest.php @@ -7,6 +7,7 @@ namespace PhpMyAdmin\Tests\Config; use PhpMyAdmin\Config\ConfigFile; use PhpMyAdmin\Config\ServerConfigChecks; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionException; use ReflectionProperty; @@ -16,7 +17,7 @@ use function str_repeat; use const SODIUM_CRYPTO_SECRETBOX_KEYBYTES; -/** @covers \PhpMyAdmin\Config\ServerConfigChecks */ +#[CoversClass(ServerConfigChecks::class)] class ServerConfigChecksTest extends AbstractTestCase { private string $sessionID; diff --git a/test/classes/Config/Settings/ConsoleTest.php b/test/classes/Config/Settings/ConsoleTest.php index 025a27e0bf..153e018cf4 100644 --- a/test/classes/Config/Settings/ConsoleTest.php +++ b/test/classes/Config/Settings/ConsoleTest.php @@ -5,12 +5,14 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Config\Settings; use PhpMyAdmin\Config\Settings\Console; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Config\Settings\Console */ +#[CoversClass(Console::class)] class ConsoleTest extends TestCase { - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testStartHistory(mixed $actual, bool $expected): void { $console = new Console(['StartHistory' => $actual]); @@ -30,7 +32,7 @@ class ConsoleTest extends TestCase yield 'valid value with type coercion' => [1, true]; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testAlwaysExpand(mixed $actual, bool $expected): void { $console = new Console(['AlwaysExpand' => $actual]); @@ -41,7 +43,7 @@ class ConsoleTest extends TestCase $this->assertSame($expected, $consoleArray['AlwaysExpand']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testCurrentQuery(mixed $actual, bool $expected): void { $console = new Console(['CurrentQuery' => $actual]); @@ -61,7 +63,7 @@ class ConsoleTest extends TestCase yield 'valid value with type coercion' => [0, false]; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testEnterExecutes(mixed $actual, bool $expected): void { $console = new Console(['EnterExecutes' => $actual]); @@ -72,7 +74,7 @@ class ConsoleTest extends TestCase $this->assertSame($expected, $consoleArray['EnterExecutes']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testDarkTheme(mixed $actual, bool $expected): void { $console = new Console(['DarkTheme' => $actual]); @@ -83,7 +85,7 @@ class ConsoleTest extends TestCase $this->assertSame($expected, $consoleArray['DarkTheme']); } - /** @dataProvider valuesForModeProvider */ + #[DataProvider('valuesForModeProvider')] public function testMode(mixed $actual, string $expected): void { $console = new Console(['Mode' => $actual]); @@ -104,7 +106,7 @@ class ConsoleTest extends TestCase yield 'invalid value' => ['invalid', 'info']; } - /** @dataProvider valuesForHeightProvider */ + #[DataProvider('valuesForHeightProvider')] public function testHeight(mixed $actual, int $expected): void { $console = new Console(['Height' => $actual]); @@ -124,7 +126,7 @@ class ConsoleTest extends TestCase yield 'invalid value' => [0, 92]; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testGroupQueries(mixed $actual, bool $expected): void { $console = new Console(['GroupQueries' => $actual]); @@ -135,7 +137,7 @@ class ConsoleTest extends TestCase $this->assertSame($expected, $consoleArray['GroupQueries']); } - /** @dataProvider valuesForOrderByProvider */ + #[DataProvider('valuesForOrderByProvider')] public function testOrderBy(mixed $actual, string $expected): void { $console = new Console(['OrderBy' => $actual]); @@ -156,7 +158,7 @@ class ConsoleTest extends TestCase yield 'invalid value' => ['invalid', 'exec']; } - /** @dataProvider valuesForOrderProvider */ + #[DataProvider('valuesForOrderProvider')] public function testOrder(mixed $actual, string $expected): void { $console = new Console(['Order' => $actual]); diff --git a/test/classes/Config/Settings/DebugTest.php b/test/classes/Config/Settings/DebugTest.php index 1252b62e43..d3423c2ddd 100644 --- a/test/classes/Config/Settings/DebugTest.php +++ b/test/classes/Config/Settings/DebugTest.php @@ -5,12 +5,14 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Config\Settings; use PhpMyAdmin\Config\Settings\Debug; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Config\Settings\Debug */ +#[CoversClass(Debug::class)] class DebugTest extends TestCase { - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSql(mixed $actual, bool $expected): void { $debug = new Debug(['sql' => $actual]); @@ -20,7 +22,7 @@ class DebugTest extends TestCase $this->assertSame($expected, $debugArray['sql']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqllog(mixed $actual, bool $expected): void { $debug = new Debug(['sqllog' => $actual]); @@ -30,7 +32,7 @@ class DebugTest extends TestCase $this->assertSame($expected, $debugArray['sqllog']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testDemo(mixed $actual, bool $expected): void { $debug = new Debug(['demo' => $actual]); @@ -40,7 +42,7 @@ class DebugTest extends TestCase $this->assertSame($expected, $debugArray['demo']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSimple2fa(mixed $actual, bool $expected): void { $debug = new Debug(['simple2fa' => $actual]); diff --git a/test/classes/Config/Settings/ExportTest.php b/test/classes/Config/Settings/ExportTest.php index d764a68f29..46c7858846 100644 --- a/test/classes/Config/Settings/ExportTest.php +++ b/test/classes/Config/Settings/ExportTest.php @@ -5,14 +5,15 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Config\Settings; use PhpMyAdmin\Config\Settings\Export; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps - -/** @covers \PhpMyAdmin\Config\Settings\Export */ +#[CoversClass(Export::class)] class ExportTest extends TestCase { - /** @dataProvider valuesForFormatProvider */ + #[DataProvider('valuesForFormatProvider')] public function testFormat(mixed $actual, string $expected): void { $export = new Export(['format' => $actual]); @@ -42,7 +43,7 @@ class ExportTest extends TestCase yield 'invalid value' => ['invalid', 'sql']; } - /** @dataProvider valuesForMethodProvider */ + #[DataProvider('valuesForMethodProvider')] public function testMethod(mixed $actual, string $expected): void { $export = new Export(['method' => $actual]); @@ -62,7 +63,7 @@ class ExportTest extends TestCase yield 'invalid value' => ['invalid', 'quick']; } - /** @dataProvider valuesForCompressionProvider */ + #[DataProvider('valuesForCompressionProvider')] public function testCompression(mixed $actual, string $expected): void { $export = new Export(['compression' => $actual]); @@ -82,7 +83,7 @@ class ExportTest extends TestCase yield 'invalid value' => ['invalid', 'none']; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testLockTables(mixed $actual, bool $expected): void { $export = new Export(['lock_tables' => $actual]); @@ -101,7 +102,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1, true]; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testAsSeparateFiles(mixed $actual, bool $expected): void { $export = new Export(['as_separate_files' => $actual]); @@ -111,7 +112,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['as_separate_files']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testAsfile(mixed $actual, bool $expected): void { $export = new Export(['asfile' => $actual]); @@ -130,7 +131,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [0, false]; } - /** @dataProvider valuesForCharsetProvider */ + #[DataProvider('valuesForCharsetProvider')] public function testCharset(mixed $actual, string $expected): void { $export = new Export(['charset' => $actual]); @@ -149,7 +150,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testOnserver(mixed $actual, bool $expected): void { $export = new Export(['onserver' => $actual]); @@ -159,7 +160,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['onserver']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testOnserverOverwrite(mixed $actual, bool $expected): void { $export = new Export(['onserver_overwrite' => $actual]); @@ -169,7 +170,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['onserver_overwrite']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testQuickExportOnserver(mixed $actual, bool $expected): void { $export = new Export(['quick_export_onserver' => $actual]); @@ -179,7 +180,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['quick_export_onserver']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testQuickExportOnserverOverwrite(mixed $actual, bool $expected): void { $export = new Export(['quick_export_onserver_overwrite' => $actual]); @@ -189,7 +190,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['quick_export_onserver_overwrite']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testRememberFileTemplate(mixed $actual, bool $expected): void { $export = new Export(['remember_file_template' => $actual]); @@ -199,7 +200,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['remember_file_template']); } - /** @dataProvider valuesForFileTemplateTableProvider */ + #[DataProvider('valuesForFileTemplateTableProvider')] public function testFileTemplateTable(mixed $actual, string $expected): void { $export = new Export(['file_template_table' => $actual]); @@ -218,7 +219,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForFileTemplateDatabaseProvider */ + #[DataProvider('valuesForFileTemplateDatabaseProvider')] public function testFileTemplateDatabase(mixed $actual, string $expected): void { $export = new Export(['file_template_database' => $actual]); @@ -237,7 +238,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForFileTemplateServerProvider */ + #[DataProvider('valuesForFileTemplateServerProvider')] public function testFileTemplateServer(mixed $actual, string $expected): void { $export = new Export(['file_template_server' => $actual]); @@ -256,7 +257,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider structureOrDataWithDefaultDataProvider */ + #[DataProvider('structureOrDataWithDefaultDataProvider')] public function testCodegenStructureOrData(mixed $actual, string $expected): void { $export = new Export(['codegen_structure_or_data' => $actual]); @@ -276,7 +277,7 @@ class ExportTest extends TestCase yield 'invalid value' => ['invalid', 'data']; } - /** @dataProvider valuesForCodegenFormatProvider */ + #[DataProvider('valuesForCodegenFormatProvider')] public function testCodegenFormat(mixed $actual, int $expected): void { $export = new Export(['codegen_format' => $actual]); @@ -297,7 +298,7 @@ class ExportTest extends TestCase yield 'invalid value 2' => [2, 0]; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testOdsColumns(mixed $actual, bool $expected): void { $export = new Export(['ods_columns' => $actual]); @@ -307,7 +308,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['ods_columns']); } - /** @dataProvider valuesForOdsNullProvider */ + #[DataProvider('valuesForOdsNullProvider')] public function testOdsNull(mixed $actual, string $expected): void { $export = new Export(['ods_null' => $actual]); @@ -326,7 +327,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider structureOrDataWithDefaultStructureOrDataProvider */ + #[DataProvider('structureOrDataWithDefaultStructureOrDataProvider')] public function testOdtStructureOrData(mixed $actual, string $expected): void { $export = new Export(['odt_structure_or_data' => $actual]); @@ -346,7 +347,7 @@ class ExportTest extends TestCase yield 'invalid value' => ['invalid', 'structure_and_data']; } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testOdtColumns(mixed $actual, bool $expected): void { $export = new Export(['odt_columns' => $actual]); @@ -356,7 +357,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['odt_columns']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testOdtRelation(mixed $actual, bool $expected): void { $export = new Export(['odt_relation' => $actual]); @@ -366,7 +367,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['odt_relation']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testOdtComments(mixed $actual, bool $expected): void { $export = new Export(['odt_comments' => $actual]); @@ -376,7 +377,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['odt_comments']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testOdtMime(mixed $actual, bool $expected): void { $export = new Export(['odt_mime' => $actual]); @@ -386,7 +387,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['odt_mime']); } - /** @dataProvider valuesForOdtNullProvider */ + #[DataProvider('valuesForOdtNullProvider')] public function testOdtNull(mixed $actual, string $expected): void { $export = new Export(['odt_null' => $actual]); @@ -405,7 +406,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider structureOrDataWithDefaultStructureOrDataProvider */ + #[DataProvider('structureOrDataWithDefaultStructureOrDataProvider')] public function testHtmlwordStructureOrData(mixed $actual, string $expected): void { $export = new Export(['htmlword_structure_or_data' => $actual]); @@ -415,7 +416,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['htmlword_structure_or_data']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testHtmlwordColumns(mixed $actual, bool $expected): void { $export = new Export(['htmlword_columns' => $actual]); @@ -425,7 +426,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['htmlword_columns']); } - /** @dataProvider valuesForHtmlwordNullProvider */ + #[DataProvider('valuesForHtmlwordNullProvider')] public function testHtmlwordNull(mixed $actual, string $expected): void { $export = new Export(['htmlword_null' => $actual]); @@ -444,7 +445,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider structureOrDataWithDefaultStructureOrDataProvider */ + #[DataProvider('structureOrDataWithDefaultStructureOrDataProvider')] public function testTexytextStructureOrData(mixed $actual, string $expected): void { $export = new Export(['texytext_structure_or_data' => $actual]); @@ -454,7 +455,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['texytext_structure_or_data']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testTexytextColumns(mixed $actual, bool $expected): void { $export = new Export(['texytext_columns' => $actual]); @@ -464,7 +465,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['texytext_columns']); } - /** @dataProvider valuesForTexytextNullProvider */ + #[DataProvider('valuesForTexytextNullProvider')] public function testTexytextNull(mixed $actual, string $expected): void { $export = new Export(['texytext_null' => $actual]); @@ -483,7 +484,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testCsvColumns(mixed $actual, bool $expected): void { $export = new Export(['csv_columns' => $actual]); @@ -493,7 +494,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['csv_columns']); } - /** @dataProvider structureOrDataWithDefaultDataProvider */ + #[DataProvider('structureOrDataWithDefaultDataProvider')] public function testCsvStructureOrData(mixed $actual, string $expected): void { $export = new Export(['csv_structure_or_data' => $actual]); @@ -503,7 +504,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['csv_structure_or_data']); } - /** @dataProvider valuesForCsvNullProvider */ + #[DataProvider('valuesForCsvNullProvider')] public function testCsvNull(mixed $actual, string $expected): void { $export = new Export(['csv_null' => $actual]); @@ -522,7 +523,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForCsvSeparatorProvider */ + #[DataProvider('valuesForCsvSeparatorProvider')] public function testCsvSeparator(mixed $actual, string $expected): void { $export = new Export(['csv_separator' => $actual]); @@ -541,7 +542,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForCsvEnclosedProvider */ + #[DataProvider('valuesForCsvEnclosedProvider')] public function testCsvEnclosed(mixed $actual, string $expected): void { $export = new Export(['csv_enclosed' => $actual]); @@ -560,7 +561,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForCsvEscapedProvider */ + #[DataProvider('valuesForCsvEscapedProvider')] public function testCsvEscaped(mixed $actual, string $expected): void { $export = new Export(['csv_escaped' => $actual]); @@ -579,7 +580,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForCsvTerminatedProvider */ + #[DataProvider('valuesForCsvTerminatedProvider')] public function testCsvTerminated(mixed $actual, string $expected): void { $export = new Export(['csv_terminated' => $actual]); @@ -598,7 +599,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testCsvRemoveCRLF(mixed $actual, bool $expected): void { $export = new Export(['csv_removeCRLF' => $actual]); @@ -608,7 +609,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['csv_removeCRLF']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testExcelColumns(mixed $actual, bool $expected): void { $export = new Export(['excel_columns' => $actual]); @@ -618,7 +619,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['excel_columns']); } - /** @dataProvider valuesForExcelNullProvider */ + #[DataProvider('valuesForExcelNullProvider')] public function testExcelNull(mixed $actual, string $expected): void { $export = new Export(['excel_null' => $actual]); @@ -637,7 +638,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForExcelEditionProvider */ + #[DataProvider('valuesForExcelEditionProvider')] public function testExcelEdition(mixed $actual, string $expected): void { $export = new Export(['excel_edition' => $actual]); @@ -657,7 +658,7 @@ class ExportTest extends TestCase yield 'invalid value' => ['invalid', 'win']; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testExcelRemoveCRLF(mixed $actual, bool $expected): void { $export = new Export(['excel_removeCRLF' => $actual]); @@ -667,7 +668,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['excel_removeCRLF']); } - /** @dataProvider structureOrDataWithDefaultDataProvider */ + #[DataProvider('structureOrDataWithDefaultDataProvider')] public function testExcelStructureOrData(mixed $actual, string $expected): void { $export = new Export(['excel_structure_or_data' => $actual]); @@ -677,7 +678,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['excel_structure_or_data']); } - /** @dataProvider structureOrDataWithDefaultStructureOrDataProvider */ + #[DataProvider('structureOrDataWithDefaultStructureOrDataProvider')] public function testLatexStructureOrData(mixed $actual, string $expected): void { $export = new Export(['latex_structure_or_data' => $actual]); @@ -687,7 +688,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['latex_structure_or_data']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testLatexColumns(mixed $actual, bool $expected): void { $export = new Export(['latex_columns' => $actual]); @@ -697,7 +698,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['latex_columns']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testLatexRelation(mixed $actual, bool $expected): void { $export = new Export(['latex_relation' => $actual]); @@ -707,7 +708,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['latex_relation']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testLatexComments(mixed $actual, bool $expected): void { $export = new Export(['latex_comments' => $actual]); @@ -717,7 +718,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['latex_comments']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testLatexMime(mixed $actual, bool $expected): void { $export = new Export(['latex_mime' => $actual]); @@ -727,7 +728,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['latex_mime']); } - /** @dataProvider valuesForLatexNullProvider */ + #[DataProvider('valuesForLatexNullProvider')] public function testLatexNull(mixed $actual, string $expected): void { $export = new Export(['latex_null' => $actual]); @@ -746,7 +747,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testLatexCaption(mixed $actual, bool $expected): void { $export = new Export(['latex_caption' => $actual]); @@ -756,7 +757,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['latex_caption']); } - /** @dataProvider valuesForLatexStructureCaptionProvider */ + #[DataProvider('valuesForLatexStructureCaptionProvider')] public function testLatexStructureCaption(mixed $actual, string $expected): void { $export = new Export(['latex_structure_caption' => $actual]); @@ -775,7 +776,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForLatexStructureContinuedCaptionProvider */ + #[DataProvider('valuesForLatexStructureContinuedCaptionProvider')] public function testLatexStructureContinuedCaption(mixed $actual, string $expected): void { $export = new Export(['latex_structure_continued_caption' => $actual]); @@ -794,7 +795,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForLatexDataCaptionProvider */ + #[DataProvider('valuesForLatexDataCaptionProvider')] public function testLatexDataCaption(mixed $actual, string $expected): void { $export = new Export(['latex_data_caption' => $actual]); @@ -813,7 +814,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForLatexDataContinuedCaptionProvider */ + #[DataProvider('valuesForLatexDataContinuedCaptionProvider')] public function testLatexDataContinuedCaption(mixed $actual, string $expected): void { $export = new Export(['latex_data_continued_caption' => $actual]); @@ -832,7 +833,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForLatexDataLabelProvider */ + #[DataProvider('valuesForLatexDataLabelProvider')] public function testLatexDataLabel(mixed $actual, string $expected): void { $export = new Export(['latex_data_label' => $actual]); @@ -851,7 +852,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForLatexStructureLabelProvider */ + #[DataProvider('valuesForLatexStructureLabelProvider')] public function testLatexStructureLabel(mixed $actual, string $expected): void { $export = new Export(['latex_structure_label' => $actual]); @@ -870,7 +871,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider structureOrDataWithDefaultDataProvider */ + #[DataProvider('structureOrDataWithDefaultDataProvider')] public function testMediawikiStructureOrData(mixed $actual, string $expected): void { $export = new Export(['mediawiki_structure_or_data' => $actual]); @@ -880,7 +881,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['mediawiki_structure_or_data']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testMediawikiCaption(mixed $actual, bool $expected): void { $export = new Export(['mediawiki_caption' => $actual]); @@ -890,7 +891,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['mediawiki_caption']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testMediawikiHeaders(mixed $actual, bool $expected): void { $export = new Export(['mediawiki_headers' => $actual]); @@ -900,7 +901,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['mediawiki_headers']); } - /** @dataProvider structureOrDataWithDefaultDataProvider */ + #[DataProvider('structureOrDataWithDefaultDataProvider')] public function testOdsStructureOrData(mixed $actual, string $expected): void { $export = new Export(['ods_structure_or_data' => $actual]); @@ -910,7 +911,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['ods_structure_or_data']); } - /** @dataProvider structureOrDataWithDefaultDataProvider */ + #[DataProvider('structureOrDataWithDefaultDataProvider')] public function testPdfStructureOrData(mixed $actual, string $expected): void { $export = new Export(['pdf_structure_or_data' => $actual]); @@ -920,7 +921,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['pdf_structure_or_data']); } - /** @dataProvider structureOrDataWithDefaultDataProvider */ + #[DataProvider('structureOrDataWithDefaultDataProvider')] public function testPhparrayStructureOrData(mixed $actual, string $expected): void { $export = new Export(['phparray_structure_or_data' => $actual]); @@ -930,7 +931,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['phparray_structure_or_data']); } - /** @dataProvider structureOrDataWithDefaultDataProvider */ + #[DataProvider('structureOrDataWithDefaultDataProvider')] public function testJsonStructureOrData(mixed $actual, string $expected): void { $export = new Export(['json_structure_or_data' => $actual]); @@ -940,7 +941,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['json_structure_or_data']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testJsonPrettyPrint(mixed $actual, bool $expected): void { $export = new Export(['json_pretty_print' => $actual]); @@ -950,7 +951,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['json_pretty_print']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testJsonUnicode(mixed $actual, bool $expected): void { $export = new Export(['json_unicode' => $actual]); @@ -960,7 +961,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['json_unicode']); } - /** @dataProvider structureOrDataWithDefaultStructureOrDataProvider */ + #[DataProvider('structureOrDataWithDefaultStructureOrDataProvider')] public function testSqlStructureOrData(mixed $actual, string $expected): void { $export = new Export(['sql_structure_or_data' => $actual]); @@ -970,7 +971,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_structure_or_data']); } - /** @dataProvider valuesForSqlCompatibilityProvider */ + #[DataProvider('valuesForSqlCompatibilityProvider')] public function testSqlCompatibility(mixed $actual, string $expected): void { $export = new Export(['sql_compatibility' => $actual]); @@ -997,7 +998,7 @@ class ExportTest extends TestCase yield 'invalid value' => ['invalid', 'NONE']; } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSqlIncludeComments(mixed $actual, bool $expected): void { $export = new Export(['sql_include_comments' => $actual]); @@ -1007,7 +1008,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_include_comments']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlDisableFk(mixed $actual, bool $expected): void { $export = new Export(['sql_disable_fk' => $actual]); @@ -1017,7 +1018,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_disable_fk']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlViewsAsTables(mixed $actual, bool $expected): void { $export = new Export(['sql_views_as_tables' => $actual]); @@ -1027,7 +1028,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_views_as_tables']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlMetadata(mixed $actual, bool $expected): void { $export = new Export(['sql_metadata' => $actual]); @@ -1037,7 +1038,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_metadata']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSqlUseTransaction(mixed $actual, bool $expected): void { $export = new Export(['sql_use_transaction' => $actual]); @@ -1047,7 +1048,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_use_transaction']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlCreateDatabase(mixed $actual, bool $expected): void { $export = new Export(['sql_create_database' => $actual]); @@ -1057,7 +1058,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_create_database']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlDropDatabase(mixed $actual, bool $expected): void { $export = new Export(['sql_drop_database' => $actual]); @@ -1067,7 +1068,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_drop_database']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlDropTable(mixed $actual, bool $expected): void { $export = new Export(['sql_drop_table' => $actual]); @@ -1077,7 +1078,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_drop_table']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlIfNotExists(mixed $actual, bool $expected): void { $export = new Export(['sql_if_not_exists' => $actual]); @@ -1087,7 +1088,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_if_not_exists']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlViewCurrentUser(mixed $actual, bool $expected): void { $export = new Export(['sql_view_current_user' => $actual]); @@ -1097,7 +1098,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_view_current_user']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlOrReplaceView(mixed $actual, bool $expected): void { $export = new Export(['sql_or_replace_view' => $actual]); @@ -1107,7 +1108,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_or_replace_view']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSqlProcedureFunction(mixed $actual, bool $expected): void { $export = new Export(['sql_procedure_function' => $actual]); @@ -1117,7 +1118,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_procedure_function']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSqlCreateTable(mixed $actual, bool $expected): void { $export = new Export(['sql_create_table' => $actual]); @@ -1127,7 +1128,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_create_table']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSqlCreateView(mixed $actual, bool $expected): void { $export = new Export(['sql_create_view' => $actual]); @@ -1137,7 +1138,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_create_view']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSqlCreateTrigger(mixed $actual, bool $expected): void { $export = new Export(['sql_create_trigger' => $actual]); @@ -1147,7 +1148,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_create_trigger']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSqlAutoIncrement(mixed $actual, bool $expected): void { $export = new Export(['sql_auto_increment' => $actual]); @@ -1157,7 +1158,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_auto_increment']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSqlBackquotes(mixed $actual, bool $expected): void { $export = new Export(['sql_backquotes' => $actual]); @@ -1167,7 +1168,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_backquotes']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlDates(mixed $actual, bool $expected): void { $export = new Export(['sql_dates' => $actual]); @@ -1177,7 +1178,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_dates']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlRelation(mixed $actual, bool $expected): void { $export = new Export(['sql_relation' => $actual]); @@ -1187,7 +1188,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_relation']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlTruncate(mixed $actual, bool $expected): void { $export = new Export(['sql_truncate' => $actual]); @@ -1197,7 +1198,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_truncate']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlDelayed(mixed $actual, bool $expected): void { $export = new Export(['sql_delayed' => $actual]); @@ -1207,7 +1208,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_delayed']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlIgnore(mixed $actual, bool $expected): void { $export = new Export(['sql_ignore' => $actual]); @@ -1217,7 +1218,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_ignore']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSqlUtcTime(mixed $actual, bool $expected): void { $export = new Export(['sql_utc_time' => $actual]); @@ -1227,7 +1228,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_utc_time']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSqlHexForBinary(mixed $actual, bool $expected): void { $export = new Export(['sql_hex_for_binary' => $actual]); @@ -1237,7 +1238,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_hex_for_binary']); } - /** @dataProvider valuesForSqlTypeProvider */ + #[DataProvider('valuesForSqlTypeProvider')] public function testSqlType(mixed $actual, string $expected): void { $export = new Export(['sql_type' => $actual]); @@ -1257,7 +1258,7 @@ class ExportTest extends TestCase yield 'invalid value' => ['invalid', 'INSERT']; } - /** @dataProvider valuesForSqlMaxQuerySizeProvider */ + #[DataProvider('valuesForSqlMaxQuerySizeProvider')] public function testSqlMaxQuerySize(mixed $actual, int $expected): void { $export = new Export(['sql_max_query_size' => $actual]); @@ -1276,7 +1277,7 @@ class ExportTest extends TestCase yield 'invalid value' => [-1, 50000]; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlMime(mixed $actual, bool $expected): void { $export = new Export(['sql_mime' => $actual]); @@ -1286,7 +1287,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['sql_mime']); } - /** @dataProvider valuesForSqlHeaderCommentProvider */ + #[DataProvider('valuesForSqlHeaderCommentProvider')] public function testSqlHeaderComment(mixed $actual, string $expected): void { $export = new Export(['sql_header_comment' => $actual]); @@ -1305,7 +1306,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForSqlInsertSyntaxProvider */ + #[DataProvider('valuesForSqlInsertSyntaxProvider')] public function testSqlInsertSyntax(mixed $actual, string $expected): void { $export = new Export(['sql_insert_syntax' => $actual]); @@ -1327,7 +1328,7 @@ class ExportTest extends TestCase yield 'invalid value 2' => ['', 'both']; } - /** @dataProvider valuesForPdfReportTitleProvider */ + #[DataProvider('valuesForPdfReportTitleProvider')] public function testPdfReportTitle(mixed $actual, string $expected): void { $export = new Export(['pdf_report_title' => $actual]); @@ -1346,7 +1347,7 @@ class ExportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider structureOrDataWithDefaultDataProvider */ + #[DataProvider('structureOrDataWithDefaultDataProvider')] public function testXmlStructureOrData(mixed $actual, string $expected): void { $export = new Export(['xml_structure_or_data' => $actual]); @@ -1356,7 +1357,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['xml_structure_or_data']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testXmlExportStruc(mixed $actual, bool $expected): void { $export = new Export(['xml_export_struc' => $actual]); @@ -1366,7 +1367,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['xml_export_struc']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testXmlExportEvents(mixed $actual, bool $expected): void { $export = new Export(['xml_export_events' => $actual]); @@ -1376,7 +1377,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['xml_export_events']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testXmlExportFunctions(mixed $actual, bool $expected): void { $export = new Export(['xml_export_functions' => $actual]); @@ -1386,7 +1387,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['xml_export_functions']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testXmlExportProcedures(mixed $actual, bool $expected): void { $export = new Export(['xml_export_procedures' => $actual]); @@ -1396,7 +1397,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['xml_export_procedures']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testXmlExportTables(mixed $actual, bool $expected): void { $export = new Export(['xml_export_tables' => $actual]); @@ -1406,7 +1407,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['xml_export_tables']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testXmlExportTriggers(mixed $actual, bool $expected): void { $export = new Export(['xml_export_triggers' => $actual]); @@ -1416,7 +1417,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['xml_export_triggers']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testXmlExportViews(mixed $actual, bool $expected): void { $export = new Export(['xml_export_views' => $actual]); @@ -1426,7 +1427,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['xml_export_views']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testXmlExportContents(mixed $actual, bool $expected): void { $export = new Export(['xml_export_contents' => $actual]); @@ -1436,7 +1437,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['xml_export_contents']); } - /** @dataProvider structureOrDataWithDefaultDataProvider */ + #[DataProvider('structureOrDataWithDefaultDataProvider')] public function testYamlStructureOrData(mixed $actual, string $expected): void { $export = new Export(['yaml_structure_or_data' => $actual]); @@ -1446,7 +1447,7 @@ class ExportTest extends TestCase $this->assertSame($expected, $exportArray['yaml_structure_or_data']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testRemoveDefinerFromDefinitions(mixed $actual, bool $expected): void { $export = new Export(['remove_definer_from_definitions' => $actual]); diff --git a/test/classes/Config/Settings/ImportTest.php b/test/classes/Config/Settings/ImportTest.php index cae56b9492..7e677c1b52 100644 --- a/test/classes/Config/Settings/ImportTest.php +++ b/test/classes/Config/Settings/ImportTest.php @@ -5,14 +5,15 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Config\Settings; use PhpMyAdmin\Config\Settings\Import; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps - -/** @covers \PhpMyAdmin\Config\Settings\Import */ +#[CoversClass(Import::class)] class ImportTest extends TestCase { - /** @dataProvider valuesForFormatProvider */ + #[DataProvider('valuesForFormatProvider')] public function testFormat(mixed $actual, string $expected): void { $import = new Import(['format' => $actual]); @@ -33,7 +34,7 @@ class ImportTest extends TestCase yield 'invalid value' => ['invalid', 'sql']; } - /** @dataProvider valuesForCharsetProvider */ + #[DataProvider('valuesForCharsetProvider')] public function testCharset(mixed $actual, string $expected): void { $import = new Import(['charset' => $actual]); @@ -52,7 +53,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testAllowInterrupt(mixed $actual, bool $expected): void { $import = new Import(['allow_interrupt' => $actual]); @@ -71,7 +72,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [0, false]; } - /** @dataProvider valuesForSkipQueriesProvider */ + #[DataProvider('valuesForSkipQueriesProvider')] public function testSkipQueries(mixed $actual, int $expected): void { $import = new Import(['skip_queries' => $actual]); @@ -91,7 +92,7 @@ class ImportTest extends TestCase yield 'invalid value' => [-1, 0]; } - /** @dataProvider valuesForSqlCompatibilityProvider */ + #[DataProvider('valuesForSqlCompatibilityProvider')] public function testSqlCompatibility(mixed $actual, string $expected): void { $import = new Import(['sql_compatibility' => $actual]); @@ -118,7 +119,7 @@ class ImportTest extends TestCase yield 'invalid value' => ['invalid', 'NONE']; } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSqlNoAutoValueOnZero(mixed $actual, bool $expected): void { $import = new Import(['sql_no_auto_value_on_zero' => $actual]); @@ -128,7 +129,7 @@ class ImportTest extends TestCase $this->assertSame($expected, $importArray['sql_no_auto_value_on_zero']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSqlReadAsMultibytes(mixed $actual, bool $expected): void { $import = new Import(['sql_read_as_multibytes' => $actual]); @@ -147,7 +148,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1, true]; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testCsvReplace(mixed $actual, bool $expected): void { $import = new Import(['csv_replace' => $actual]); @@ -157,7 +158,7 @@ class ImportTest extends TestCase $this->assertSame($expected, $importArray['csv_replace']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testCsvIgnore(mixed $actual, bool $expected): void { $import = new Import(['csv_ignore' => $actual]); @@ -167,7 +168,7 @@ class ImportTest extends TestCase $this->assertSame($expected, $importArray['csv_ignore']); } - /** @dataProvider valuesForCsvTerminatedProvider */ + #[DataProvider('valuesForCsvTerminatedProvider')] public function testCsvTerminated(mixed $actual, string $expected): void { $import = new Import(['csv_terminated' => $actual]); @@ -186,7 +187,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForCsvEnclosedProvider */ + #[DataProvider('valuesForCsvEnclosedProvider')] public function testCsvEnclosed(mixed $actual, string $expected): void { $import = new Import(['csv_enclosed' => $actual]); @@ -205,7 +206,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForCsvEscapedProvider */ + #[DataProvider('valuesForCsvEscapedProvider')] public function testCsvEscaped(mixed $actual, string $expected): void { $import = new Import(['csv_escaped' => $actual]); @@ -224,7 +225,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForCsvNewLineProvider */ + #[DataProvider('valuesForCsvNewLineProvider')] public function testCsvNewLine(mixed $actual, string $expected): void { $import = new Import(['csv_new_line' => $actual]); @@ -243,7 +244,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForCsvColumnsProvider */ + #[DataProvider('valuesForCsvColumnsProvider')] public function testCsvColumns(mixed $actual, string $expected): void { $import = new Import(['csv_columns' => $actual]); @@ -262,7 +263,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testCsvColNames(mixed $actual, bool $expected): void { $import = new Import(['csv_col_names' => $actual]); @@ -272,7 +273,7 @@ class ImportTest extends TestCase $this->assertSame($expected, $importArray['csv_col_names']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testLdiReplace(mixed $actual, bool $expected): void { $import = new Import(['ldi_replace' => $actual]); @@ -282,7 +283,7 @@ class ImportTest extends TestCase $this->assertSame($expected, $importArray['ldi_replace']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testLdiIgnore(mixed $actual, bool $expected): void { $import = new Import(['ldi_ignore' => $actual]); @@ -292,7 +293,7 @@ class ImportTest extends TestCase $this->assertSame($expected, $importArray['ldi_ignore']); } - /** @dataProvider valuesForLdiTerminatedProvider */ + #[DataProvider('valuesForLdiTerminatedProvider')] public function testLdiTerminated(mixed $actual, string $expected): void { $import = new Import(['ldi_terminated' => $actual]); @@ -311,7 +312,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForLdiEnclosedProvider */ + #[DataProvider('valuesForLdiEnclosedProvider')] public function testLdiEnclosed(mixed $actual, string $expected): void { $import = new Import(['ldi_enclosed' => $actual]); @@ -330,7 +331,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForLdiEscapedProvider */ + #[DataProvider('valuesForLdiEscapedProvider')] public function testLdiEscaped(mixed $actual, string $expected): void { $import = new Import(['ldi_escaped' => $actual]); @@ -349,7 +350,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForLdiNewLineProvider */ + #[DataProvider('valuesForLdiNewLineProvider')] public function testLdiNewLine(mixed $actual, string $expected): void { $import = new Import(['ldi_new_line' => $actual]); @@ -368,7 +369,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForLdiColumnsProvider */ + #[DataProvider('valuesForLdiColumnsProvider')] public function testLdiColumns(mixed $actual, string $expected): void { $import = new Import(['ldi_columns' => $actual]); @@ -387,7 +388,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForLdiLocalOptionProvider */ + #[DataProvider('valuesForLdiLocalOptionProvider')] public function testLdiLocalOption(mixed $actual, string|bool $expected): void { $import = new Import(['ldi_local_option' => $actual]); @@ -407,7 +408,7 @@ class ImportTest extends TestCase yield 'valid value with type coercion' => ['1', true]; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testOdsColNames(mixed $actual, bool $expected): void { $import = new Import(['ods_col_names' => $actual]); @@ -417,7 +418,7 @@ class ImportTest extends TestCase $this->assertSame($expected, $importArray['ods_col_names']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testOdsEmptyRows(mixed $actual, bool $expected): void { $import = new Import(['ods_empty_rows' => $actual]); @@ -427,7 +428,7 @@ class ImportTest extends TestCase $this->assertSame($expected, $importArray['ods_empty_rows']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testOdsRecognizePercentages(mixed $actual, bool $expected): void { $import = new Import(['ods_recognize_percentages' => $actual]); @@ -437,7 +438,7 @@ class ImportTest extends TestCase $this->assertSame($expected, $importArray['ods_recognize_percentages']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testOdsRecognizeCurrency(mixed $actual, bool $expected): void { $import = new Import(['ods_recognize_currency' => $actual]); diff --git a/test/classes/Config/Settings/SchemaTest.php b/test/classes/Config/Settings/SchemaTest.php index 706cf68ca9..b093736631 100644 --- a/test/classes/Config/Settings/SchemaTest.php +++ b/test/classes/Config/Settings/SchemaTest.php @@ -5,12 +5,14 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Config\Settings; use PhpMyAdmin\Config\Settings\Schema; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function array_keys; use function array_merge; -/** @covers \PhpMyAdmin\Config\Settings\Schema */ +#[CoversClass(Schema::class)] class SchemaTest extends TestCase { /** @var array */ @@ -40,9 +42,8 @@ class SchemaTest extends TestCase /** * @param mixed[][] $values * @psalm-param (array{0: string, 1: mixed, 2: mixed})[] $values - * - * @dataProvider providerForTestConstructor */ + #[DataProvider('providerForTestConstructor')] public function testConstructor(array $values): void { $actualValues = []; diff --git a/test/classes/Config/Settings/ServerTest.php b/test/classes/Config/Settings/ServerTest.php index d0e39d3078..77c9a348bf 100644 --- a/test/classes/Config/Settings/ServerTest.php +++ b/test/classes/Config/Settings/ServerTest.php @@ -5,12 +5,14 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Config\Settings; use PhpMyAdmin\Config\Settings\Server; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Config\Settings\Server */ +#[CoversClass(Server::class)] class ServerTest extends TestCase { - /** @dataProvider valuesForHostProvider */ + #[DataProvider('valuesForHostProvider')] public function testHost(mixed $actual, string $expected): void { $server = new Server(['host' => $actual]); @@ -29,7 +31,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForPortProvider */ + #[DataProvider('valuesForPortProvider')] public function testPort(mixed $actual, string $expected): void { $server = new Server(['port' => $actual]); @@ -48,7 +50,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForSocketProvider */ + #[DataProvider('valuesForSocketProvider')] public function testSocket(mixed $actual, string $expected): void { $server = new Server(['socket' => $actual]); @@ -67,7 +69,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSsl(mixed $actual, bool $expected): void { $server = new Server(['ssl' => $actual]); @@ -86,7 +88,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1, true]; } - /** @dataProvider valuesForSslOptionsProvider */ + #[DataProvider('valuesForSslOptionsProvider')] public function testSslKey(mixed $actual, string|null $expected): void { $server = new Server(['ssl_key' => $actual]); @@ -105,7 +107,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForSslOptionsProvider */ + #[DataProvider('valuesForSslOptionsProvider')] public function testSslCert(mixed $actual, string|null $expected): void { $server = new Server(['ssl_cert' => $actual]); @@ -115,7 +117,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['ssl_cert']); } - /** @dataProvider valuesForSslOptionsProvider */ + #[DataProvider('valuesForSslOptionsProvider')] public function testSslCa(mixed $actual, string|null $expected): void { $server = new Server(['ssl_ca' => $actual]); @@ -125,7 +127,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['ssl_ca']); } - /** @dataProvider valuesForSslOptionsProvider */ + #[DataProvider('valuesForSslOptionsProvider')] public function testSslCaPath(mixed $actual, string|null $expected): void { $server = new Server(['ssl_ca_path' => $actual]); @@ -135,7 +137,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['ssl_ca_path']); } - /** @dataProvider valuesForSslOptionsProvider */ + #[DataProvider('valuesForSslOptionsProvider')] public function testSslCiphers(mixed $actual, string|null $expected): void { $server = new Server(['ssl_ciphers' => $actual]); @@ -145,7 +147,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['ssl_ciphers']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testSslVerify(mixed $actual, bool $expected): void { $server = new Server(['ssl_verify' => $actual]); @@ -164,7 +166,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [0, false]; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testCompress(mixed $actual, bool $expected): void { $server = new Server(['compress' => $actual]); @@ -174,7 +176,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['compress']); } - /** @dataProvider valuesForControlHostProvider */ + #[DataProvider('valuesForControlHostProvider')] public function testControlHost(mixed $actual, string $expected): void { $server = new Server(['controlhost' => $actual]); @@ -184,7 +186,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['controlhost']); } - /** @dataProvider valuesForControlHostProvider */ + #[DataProvider('valuesForControlHostProvider')] public function testControlHost2(mixed $actual, string $expected): void { $server = new Server(['control_host' => $actual]); @@ -203,7 +205,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForControlPortProvider */ + #[DataProvider('valuesForControlPortProvider')] public function testControlPort(mixed $actual, string $expected): void { $server = new Server(['controlport' => $actual]); @@ -213,7 +215,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['controlport']); } - /** @dataProvider valuesForControlPortProvider */ + #[DataProvider('valuesForControlPortProvider')] public function testControlPort2(mixed $actual, string $expected): void { $server = new Server(['control_port' => $actual]); @@ -232,7 +234,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForControlUserProvider */ + #[DataProvider('valuesForControlUserProvider')] public function testControlUser(mixed $actual, string $expected): void { $server = new Server(['controluser' => $actual]); @@ -242,7 +244,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['controluser']); } - /** @dataProvider valuesForControlUserProvider */ + #[DataProvider('valuesForControlUserProvider')] public function testControlUser2(mixed $actual, string $expected): void { $server = new Server(['control_user' => $actual]); @@ -261,7 +263,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForControlPassProvider */ + #[DataProvider('valuesForControlPassProvider')] public function testControlPass(mixed $actual, string $expected): void { $server = new Server(['controlpass' => $actual]); @@ -271,7 +273,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['controlpass']); } - /** @dataProvider valuesForControlPassProvider */ + #[DataProvider('valuesForControlPassProvider')] public function testControlPass2(mixed $actual, string $expected): void { $server = new Server(['control_pass' => $actual]); @@ -281,7 +283,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['controlpass']); } - /** @dataProvider valuesForControlPassProvider */ + #[DataProvider('valuesForControlPassProvider')] public function testControlPass3(mixed $actual, string $expected): void { $server = new Server(['control_password' => $actual]); @@ -300,7 +302,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForControlSocketProvider */ + #[DataProvider('valuesForControlSocketProvider')] public function testControlSocket(mixed $actual, string|null $expected): void { $server = new Server(['control_socket' => $actual]); @@ -319,7 +321,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForControlSslProvider */ + #[DataProvider('valuesForControlSslProvider')] public function testControlSsl(mixed $actual, bool|null $expected): void { $server = new Server(['control_ssl' => $actual]); @@ -338,7 +340,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1, true]; } - /** @dataProvider valuesForSslOptionsProvider */ + #[DataProvider('valuesForSslOptionsProvider')] public function testControlSslKey(mixed $actual, string|null $expected): void { $server = new Server(['control_ssl_key' => $actual]); @@ -348,7 +350,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['control_ssl_key']); } - /** @dataProvider valuesForSslOptionsProvider */ + #[DataProvider('valuesForSslOptionsProvider')] public function testControlSslCert(mixed $actual, string|null $expected): void { $server = new Server(['control_ssl_cert' => $actual]); @@ -358,7 +360,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['control_ssl_cert']); } - /** @dataProvider valuesForSslOptionsProvider */ + #[DataProvider('valuesForSslOptionsProvider')] public function testControlSslCa(mixed $actual, string|null $expected): void { $server = new Server(['control_ssl_ca' => $actual]); @@ -368,7 +370,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['control_ssl_ca']); } - /** @dataProvider valuesForSslOptionsProvider */ + #[DataProvider('valuesForSslOptionsProvider')] public function testControlSslCaPath(mixed $actual, string|null $expected): void { $server = new Server(['control_ssl_ca_path' => $actual]); @@ -378,7 +380,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['control_ssl_ca_path']); } - /** @dataProvider valuesForSslOptionsProvider */ + #[DataProvider('valuesForSslOptionsProvider')] public function testControlSslCiphers(mixed $actual, string|null $expected): void { $server = new Server(['control_ssl_ciphers' => $actual]); @@ -388,7 +390,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['control_ssl_ciphers']); } - /** @dataProvider valuesForControlSslVerifyProvider */ + #[DataProvider('valuesForControlSslVerifyProvider')] public function testControlSslVerify(mixed $actual, bool|null $expected): void { $server = new Server(['control_ssl_verify' => $actual]); @@ -407,7 +409,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [0, false]; } - /** @dataProvider valuesForControlCompressProvider */ + #[DataProvider('valuesForControlCompressProvider')] public function testControlCompress(mixed $actual, bool|null $expected): void { $server = new Server(['control_compress' => $actual]); @@ -426,7 +428,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1, true]; } - /** @dataProvider valuesForControlHideConnectionErrorsProvider */ + #[DataProvider('valuesForControlHideConnectionErrorsProvider')] public function testControlHideConnectionErrors(mixed $actual, bool|null $expected): void { $server = new Server(['control_hide_connection_errors' => $actual]); @@ -445,7 +447,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1, true]; } - /** @dataProvider valuesForAuthTypeProvider */ + #[DataProvider('valuesForAuthTypeProvider')] public function testAuthType(mixed $actual, string $expected): void { $server = new Server(['auth_type' => $actual]); @@ -466,7 +468,7 @@ class ServerTest extends TestCase yield 'invalid value' => ['invalid', 'cookie']; } - /** @dataProvider valuesForAuthHttpRealmProvider */ + #[DataProvider('valuesForAuthHttpRealmProvider')] public function testAuthHttpRealm(mixed $actual, string $expected): void { $server = new Server(['auth_http_realm' => $actual]); @@ -485,7 +487,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForUserProvider */ + #[DataProvider('valuesForUserProvider')] public function testUser(mixed $actual, string $expected): void { $server = new Server(['user' => $actual]); @@ -504,7 +506,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForPasswordProvider */ + #[DataProvider('valuesForPasswordProvider')] public function testPassword(mixed $actual, string $expected): void { $server = new Server(['password' => $actual]); @@ -523,7 +525,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForSignonSessionProvider */ + #[DataProvider('valuesForSignonSessionProvider')] public function testSignonSession(mixed $actual, string $expected): void { $server = new Server(['SignonSession' => $actual]); @@ -542,11 +544,8 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** - * @param array $expected - * - * @dataProvider valuesForSignonCookieParamsProvider - */ + /** @param array $expected */ + #[DataProvider('valuesForSignonCookieParamsProvider')] public function testSignonCookieParams(mixed $actual, array $expected): void { $server = new Server(['SignonCookieParams' => $actual]); @@ -616,7 +615,7 @@ class ServerTest extends TestCase ]; } - /** @dataProvider valuesForSignonScriptProvider */ + #[DataProvider('valuesForSignonScriptProvider')] public function testSignonScript(mixed $actual, string $expected): void { $server = new Server(['SignonScript' => $actual]); @@ -635,7 +634,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForSignonURLProvider */ + #[DataProvider('valuesForSignonURLProvider')] public function testSignonURL(mixed $actual, string $expected): void { $server = new Server(['SignonURL' => $actual]); @@ -654,7 +653,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForLogoutURLProvider */ + #[DataProvider('valuesForLogoutURLProvider')] public function testLogoutURL(mixed $actual, string $expected): void { $server = new Server(['LogoutURL' => $actual]); @@ -673,11 +672,8 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** - * @param string|string[] $expected - * - * @dataProvider valuesForOnlyDbProvider - */ + /** @param string|string[] $expected */ + #[DataProvider('valuesForOnlyDbProvider')] public function testOnlyDb(mixed $actual, string|array $expected): void { $server = new Server(['only_db' => $actual]); @@ -697,7 +693,7 @@ class ServerTest extends TestCase yield 'invalid value' => [[], '']; } - /** @dataProvider valuesForHideDbProvider */ + #[DataProvider('valuesForHideDbProvider')] public function testHideDb(mixed $actual, string $expected): void { $server = new Server(['hide_db' => $actual]); @@ -716,7 +712,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForVerboseProvider */ + #[DataProvider('valuesForVerboseProvider')] public function testVerbose(mixed $actual, string $expected): void { $server = new Server(['verbose' => $actual]); @@ -735,7 +731,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForPmaDbProvider */ + #[DataProvider('valuesForPmaDbProvider')] public function testPmaDb(mixed $actual, string $expected): void { $server = new Server(['pmadb' => $actual]); @@ -754,7 +750,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testBookmarkTable(mixed $actual, string|false $expected): void { $server = new Server(['bookmarktable' => $actual]); @@ -774,7 +770,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [true, '1']; } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testRelation(mixed $actual, string|false $expected): void { $server = new Server(['relation' => $actual]); @@ -784,7 +780,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['relation']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testTableInfo(mixed $actual, string|false $expected): void { $server = new Server(['table_info' => $actual]); @@ -794,7 +790,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['table_info']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testPdfPages(mixed $actual, string|false $expected): void { $server = new Server(['pdf_pages' => $actual]); @@ -804,7 +800,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['pdf_pages']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testColumnInfo(mixed $actual, string|false $expected): void { $server = new Server(['column_info' => $actual]); @@ -814,7 +810,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['column_info']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testHistory(mixed $actual, string|false $expected): void { $server = new Server(['history' => $actual]); @@ -824,7 +820,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['history']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testRecent(mixed $actual, string|false $expected): void { $server = new Server(['recent' => $actual]); @@ -834,7 +830,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['recent']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testFavorite(mixed $actual, string|false $expected): void { $server = new Server(['favorite' => $actual]); @@ -844,7 +840,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['favorite']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testTableUiPrefs(mixed $actual, string|false $expected): void { $server = new Server(['table_uiprefs' => $actual]); @@ -854,7 +850,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['table_uiprefs']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testTracking(mixed $actual, string|false $expected): void { $server = new Server(['tracking' => $actual]); @@ -864,7 +860,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['tracking']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testUserConfig(mixed $actual, string|false $expected): void { $server = new Server(['userconfig' => $actual]); @@ -874,7 +870,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['userconfig']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testUsers(mixed $actual, string|false $expected): void { $server = new Server(['users' => $actual]); @@ -884,7 +880,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['users']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testUserGroups(mixed $actual, string|false $expected): void { $server = new Server(['usergroups' => $actual]); @@ -894,7 +890,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['usergroups']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testNavigationHiding(mixed $actual, string|false $expected): void { $server = new Server(['navigationhiding' => $actual]); @@ -904,7 +900,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['navigationhiding']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testSavedSearches(mixed $actual, string|false $expected): void { $server = new Server(['savedsearches' => $actual]); @@ -914,7 +910,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['savedsearches']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testCentralColumns(mixed $actual, string|false $expected): void { $server = new Server(['central_columns' => $actual]); @@ -924,7 +920,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['central_columns']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testDesignerSettings(mixed $actual, string|false $expected): void { $server = new Server(['designer_settings' => $actual]); @@ -934,7 +930,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['designer_settings']); } - /** @dataProvider valuesForConfigStorageTablesProvider */ + #[DataProvider('valuesForConfigStorageTablesProvider')] public function testExportTemplates(mixed $actual, string|false $expected): void { $server = new Server(['export_templates' => $actual]); @@ -944,7 +940,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['export_templates']); } - /** @dataProvider valuesForMaxTableUiPrefsProvider */ + #[DataProvider('valuesForMaxTableUiPrefsProvider')] public function testMaxTableUiPrefs(mixed $actual, int $expected): void { $server = new Server(['MaxTableUiprefs' => $actual]); @@ -964,7 +960,7 @@ class ServerTest extends TestCase yield 'invalid value 2' => [0, 100]; } - /** @dataProvider valuesForSessionTimeZoneProvider */ + #[DataProvider('valuesForSessionTimeZoneProvider')] public function testSessionTimeZone(mixed $actual, string $expected): void { $server = new Server(['SessionTimeZone' => $actual]); @@ -983,7 +979,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testAllowRoot(mixed $actual, bool $expected): void { $server = new Server(['AllowRoot' => $actual]); @@ -993,7 +989,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['AllowRoot']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testAllowNoPassword(mixed $actual, bool $expected): void { $server = new Server(['AllowNoPassword' => $actual]); @@ -1003,11 +999,8 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['AllowNoPassword']); } - /** - * @param array $expected - * - * @dataProvider valuesForAllowDenyProvider - */ + /** @param array $expected */ + #[DataProvider('valuesForAllowDenyProvider')] public function testAllowDeny(mixed $actual, array $expected): void { $server = new Server(['AllowDeny' => $actual]); @@ -1038,7 +1031,7 @@ class ServerTest extends TestCase ]; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testDisableIS(mixed $actual, bool $expected): void { $server = new Server(['DisableIS' => $actual]); @@ -1048,7 +1041,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['DisableIS']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testTrackingVersionAutoCreate(mixed $actual, bool $expected): void { $server = new Server(['tracking_version_auto_create' => $actual]); @@ -1058,7 +1051,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['tracking_version_auto_create']); } - /** @dataProvider valuesForTrackingDefaultStatementsProvider */ + #[DataProvider('valuesForTrackingDefaultStatementsProvider')] public function testTrackingDefaultStatements(mixed $actual, string $expected): void { $server = new Server(['tracking_default_statements' => $actual]); @@ -1082,7 +1075,7 @@ class ServerTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testTrackingAddDropView(mixed $actual, bool $expected): void { $server = new Server(['tracking_add_drop_view' => $actual]); @@ -1092,7 +1085,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['tracking_add_drop_view']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testTrackingAddDropTable(mixed $actual, bool $expected): void { $server = new Server(['tracking_add_drop_table' => $actual]); @@ -1102,7 +1095,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['tracking_add_drop_table']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testTrackingAddDropDatabase(mixed $actual, bool $expected): void { $server = new Server(['tracking_add_drop_database' => $actual]); @@ -1112,7 +1105,7 @@ class ServerTest extends TestCase $this->assertSame($expected, $serverArray['tracking_add_drop_database']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testHideConnectionErrors(mixed $actual, bool $expected): void { $server = new Server(['hide_connection_errors' => $actual]); diff --git a/test/classes/Config/Settings/SqlQueryBoxTest.php b/test/classes/Config/Settings/SqlQueryBoxTest.php index 4ce84428a0..6fab9b06ef 100644 --- a/test/classes/Config/Settings/SqlQueryBoxTest.php +++ b/test/classes/Config/Settings/SqlQueryBoxTest.php @@ -5,12 +5,14 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Config\Settings; use PhpMyAdmin\Config\Settings\SqlQueryBox; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Config\Settings\SqlQueryBox */ +#[CoversClass(SqlQueryBox::class)] class SqlQueryBoxTest extends TestCase { - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testEdit(mixed $actual, bool $expected): void { $sqlQueryBox = new SqlQueryBox(['Edit' => $actual]); @@ -21,7 +23,7 @@ class SqlQueryBoxTest extends TestCase $this->assertSame($expected, $sqlQueryBoxArray['Edit']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testExplain(mixed $actual, bool $expected): void { $sqlQueryBox = new SqlQueryBox(['Explain' => $actual]); @@ -32,7 +34,7 @@ class SqlQueryBoxTest extends TestCase $this->assertSame($expected, $sqlQueryBoxArray['Explain']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testShowAsPHP(mixed $actual, bool $expected): void { $sqlQueryBox = new SqlQueryBox(['ShowAsPHP' => $actual]); @@ -43,7 +45,7 @@ class SqlQueryBoxTest extends TestCase $this->assertSame($expected, $sqlQueryBoxArray['ShowAsPHP']); } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testRefresh(mixed $actual, bool $expected): void { $sqlQueryBox = new SqlQueryBox(['Refresh' => $actual]); diff --git a/test/classes/Config/Settings/TransformationsTest.php b/test/classes/Config/Settings/TransformationsTest.php index 674e936523..6ca74234d6 100644 --- a/test/classes/Config/Settings/TransformationsTest.php +++ b/test/classes/Config/Settings/TransformationsTest.php @@ -5,16 +5,15 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Config\Settings; use PhpMyAdmin\Config\Settings\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Config\Settings\Transformations */ +#[CoversClass(Transformations::class)] class TransformationsTest extends TestCase { - /** - * @param array $expected - * - * @dataProvider valuesForSubstringProvider - */ + /** @param array $expected */ + #[DataProvider('valuesForSubstringProvider')] public function testSubstring(mixed $actual, array $expected): void { $transformations = new Transformations(['Substring' => $actual]); @@ -39,11 +38,8 @@ class TransformationsTest extends TestCase yield 'invalid value' => ['invalid', [0, 'all', '…']]; } - /** - * @param array $expected - * - * @dataProvider valuesForBool2TextProvider - */ + /** @param array $expected */ + #[DataProvider('valuesForBool2TextProvider')] public function testBool2Text(mixed $actual, array $expected): void { $transformations = new Transformations(['Bool2Text' => $actual]); @@ -66,11 +62,8 @@ class TransformationsTest extends TestCase yield 'invalid value' => ['invalid', ['T', 'F']]; } - /** - * @param array $expected - * - * @dataProvider valuesForExternalProvider - */ + /** @param array $expected */ + #[DataProvider('valuesForExternalProvider')] public function testExternal(mixed $actual, array $expected): void { $transformations = new Transformations(['External' => $actual]); @@ -96,11 +89,8 @@ class TransformationsTest extends TestCase yield 'invalid values' => ['invalid', [0, '-f /dev/null -i -wrap -q', 1, 1]]; } - /** - * @param array $expected - * - * @dataProvider valuesForPreApPendProvider - */ + /** @param array $expected */ + #[DataProvider('valuesForPreApPendProvider')] public function testPreApPend(mixed $actual, array $expected): void { $transformations = new Transformations(['PreApPend' => $actual]); @@ -123,11 +113,8 @@ class TransformationsTest extends TestCase yield 'invalid values' => ['invalid', ['', '']]; } - /** - * @param array $expected - * - * @dataProvider valuesForHexProvider - */ + /** @param array $expected */ + #[DataProvider('valuesForHexProvider')] public function testHex(mixed $actual, array $expected): void { $transformations = new Transformations(['Hex' => $actual]); @@ -149,11 +136,8 @@ class TransformationsTest extends TestCase yield 'invalid values' => ['invalid', [2]]; } - /** - * @param array $expected - * - * @dataProvider valuesForDateFormatProvider - */ + /** @param array $expected */ + #[DataProvider('valuesForDateFormatProvider')] public function testDateFormat(mixed $actual, array $expected): void { $transformations = new Transformations(['DateFormat' => $actual]); @@ -178,11 +162,8 @@ class TransformationsTest extends TestCase yield 'invalid values' => ['invalid', [0, '', 'local']]; } - /** - * @param array|null> $expected - * - * @dataProvider valuesForInlineProvider - */ + /** @param array|null> $expected */ + #[DataProvider('valuesForInlineProvider')] public function testInline(mixed $actual, array $expected): void { $transformations = new Transformations(['Inline' => $actual]); @@ -214,11 +195,8 @@ class TransformationsTest extends TestCase yield 'invalid values' => ['invalid', [100, 100, 'wrapper_link' => null, 'wrapper_params' => []]]; } - /** - * @param array $expected - * - * @dataProvider valuesForTextImageLinkProvider - */ + /** @param array $expected */ + #[DataProvider('valuesForTextImageLinkProvider')] public function testTextImageLink(mixed $actual, array $expected): void { $transformations = new Transformations(['TextImageLink' => $actual]); @@ -243,11 +221,8 @@ class TransformationsTest extends TestCase yield 'invalid values' => ['invalid', [null, 100, 50]]; } - /** - * @param array $expected - * - * @dataProvider valuesForTextLinkProvider - */ + /** @param array $expected */ + #[DataProvider('valuesForTextLinkProvider')] public function testTextLink(mixed $actual, array $expected): void { $transformations = new Transformations(['TextLink' => $actual]); diff --git a/test/classes/Config/SettingsTest.php b/test/classes/Config/SettingsTest.php index 01c06dca77..cf30e5b2f9 100644 --- a/test/classes/Config/SettingsTest.php +++ b/test/classes/Config/SettingsTest.php @@ -13,6 +13,8 @@ use PhpMyAdmin\Config\Settings\Schema; use PhpMyAdmin\Config\Settings\Server; use PhpMyAdmin\Config\Settings\SqlQueryBox; use PhpMyAdmin\Config\Settings\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function array_keys; @@ -23,18 +25,15 @@ use const DIRECTORY_SEPARATOR; use const ROOT_PATH; // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps, Generic.Files.LineLength.TooLong - -/** - * @covers \PhpMyAdmin\Config\Settings - * @covers \PhpMyAdmin\Config\Settings\Console - * @covers \PhpMyAdmin\Config\Settings\Debug - * @covers \PhpMyAdmin\Config\Settings\Export - * @covers \PhpMyAdmin\Config\Settings\Import - * @covers \PhpMyAdmin\Config\Settings\Schema - * @covers \PhpMyAdmin\Config\Settings\Server - * @covers \PhpMyAdmin\Config\Settings\SqlQueryBox - * @covers \PhpMyAdmin\Config\Settings\Transformations - */ +#[CoversClass(Settings::class)] +#[CoversClass(Console::class)] +#[CoversClass(Debug::class)] +#[CoversClass(Export::class)] +#[CoversClass(Import::class)] +#[CoversClass(Schema::class)] +#[CoversClass(Server::class)] +#[CoversClass(SqlQueryBox::class)] +#[CoversClass(Transformations::class)] class SettingsTest extends TestCase { /** @var array */ @@ -263,9 +262,8 @@ class SettingsTest extends TestCase /** * @param mixed[][] $values * @psalm-param (array{0: string, 1: mixed, 2: mixed})[] $values - * - * @dataProvider providerForTestConstructor */ + #[DataProvider('providerForTestConstructor')] public function testConstructor(array $values): void { $actualValues = []; @@ -1006,7 +1004,7 @@ class SettingsTest extends TestCase ]; } - /** @dataProvider valuesForPmaAbsoluteUriProvider */ + #[DataProvider('valuesForPmaAbsoluteUriProvider')] public function testPmaAbsoluteUri(mixed $actual, string $expected): void { $settings = new Settings(['PmaAbsoluteUri' => $actual]); @@ -1025,7 +1023,7 @@ class SettingsTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForAuthLogProvider */ + #[DataProvider('valuesForAuthLogProvider')] public function testAuthLog(mixed $actual, string $expected): void { $settings = new Settings(['AuthLog' => $actual]); @@ -1044,7 +1042,7 @@ class SettingsTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testAuthLogSuccess(mixed $actual, bool $expected): void { $settings = new Settings(['AuthLogSuccess' => $actual]); @@ -1054,7 +1052,7 @@ class SettingsTest extends TestCase $this->assertSame($expected, $settingsArray['AuthLogSuccess']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testPmaNoRelationDisableWarning(mixed $actual, bool $expected): void { $settings = new Settings(['PmaNoRelation_DisableWarning' => $actual]); @@ -1064,7 +1062,7 @@ class SettingsTest extends TestCase $this->assertSame($expected, $settingsArray['PmaNoRelation_DisableWarning']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testSuhosinDisableWarning(mixed $actual, bool $expected): void { $settings = new Settings(['SuhosinDisableWarning' => $actual]); @@ -1074,7 +1072,7 @@ class SettingsTest extends TestCase $this->assertSame($expected, $settingsArray['SuhosinDisableWarning']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testLoginCookieValidityDisableWarning(mixed $actual, bool $expected): void { $settings = new Settings(['LoginCookieValidityDisableWarning' => $actual]); @@ -1084,7 +1082,7 @@ class SettingsTest extends TestCase $this->assertSame($expected, $settingsArray['LoginCookieValidityDisableWarning']); } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testReservedWordDisableWarning(mixed $actual, bool $expected): void { $settings = new Settings(['ReservedWordDisableWarning' => $actual]); @@ -1094,7 +1092,7 @@ class SettingsTest extends TestCase $this->assertSame($expected, $settingsArray['ReservedWordDisableWarning']); } - /** @dataProvider valuesForTranslationWarningThresholdProvider */ + #[DataProvider('valuesForTranslationWarningThresholdProvider')] public function testTranslationWarningThreshold(mixed $actual, int $expected): void { $settings = new Settings(['TranslationWarningThreshold' => $actual]); @@ -1114,7 +1112,7 @@ class SettingsTest extends TestCase yield 'invalid value 2' => [101, 100]; } - /** @dataProvider valuesForAllowThirdPartyFramingProvider */ + #[DataProvider('valuesForAllowThirdPartyFramingProvider')] public function testAllowThirdPartyFraming(mixed $actual, bool|string $expected): void { $settings = new Settings(['AllowThirdPartyFraming' => $actual]); @@ -1134,7 +1132,7 @@ class SettingsTest extends TestCase yield 'valid value with type coercion' => [1, true]; } - /** @dataProvider valuesForBlowfishSecretProvider */ + #[DataProvider('valuesForBlowfishSecretProvider')] public function testBlowfishSecret(mixed $actual, string $expected): void { $settings = new Settings(['blowfish_secret' => $actual]); @@ -1153,11 +1151,8 @@ class SettingsTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** - * @param array $expected - * - * @dataProvider valuesForServersProvider - */ + /** @param array $expected */ + #[DataProvider('valuesForServersProvider')] public function testServers(mixed $actual, array $expected): void { $settings = new Settings(['Servers' => $actual]); @@ -1186,7 +1181,7 @@ class SettingsTest extends TestCase yield 'invalid value 3' => [[0 => []], [1 => $server]]; } - /** @dataProvider valuesForServerDefaultProvider */ + #[DataProvider('valuesForServerDefaultProvider')] public function testServerDefault(mixed $actual, int $expected): void { $settings = new Settings(['ServerDefault' => $actual]); @@ -1205,7 +1200,7 @@ class SettingsTest extends TestCase yield 'invalid value' => [-1, 1]; } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testVersionCheck(mixed $actual, bool $expected): void { $settings = new Settings(['VersionCheck' => $actual]); @@ -1215,7 +1210,7 @@ class SettingsTest extends TestCase $this->assertSame($expected, $settingsArray['VersionCheck']); } - /** @dataProvider valuesForProxyUrlProvider */ + #[DataProvider('valuesForProxyUrlProvider')] public function testProxyUrl(mixed $actual, string $expected): void { $settings = new Settings(['ProxyUrl' => $actual]); @@ -1234,7 +1229,7 @@ class SettingsTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForProxyUserProvider */ + #[DataProvider('valuesForProxyUserProvider')] public function testProxyUser(mixed $actual, string $expected): void { $settings = new Settings(['ProxyUser' => $actual]); @@ -1253,7 +1248,7 @@ class SettingsTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForProxyPassProvider */ + #[DataProvider('valuesForProxyPassProvider')] public function testProxyPass(mixed $actual, string $expected): void { $settings = new Settings(['ProxyPass' => $actual]); @@ -1272,7 +1267,7 @@ class SettingsTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider valuesForMaxDbListProvider */ + #[DataProvider('valuesForMaxDbListProvider')] public function testMaxDbList(mixed $actual, int $expected): void { $settings = new Settings(['MaxDbList' => $actual]); @@ -1291,7 +1286,7 @@ class SettingsTest extends TestCase yield 'invalid value' => [0, 100]; } - /** @dataProvider valuesForMaxTableListProvider */ + #[DataProvider('valuesForMaxTableListProvider')] public function testMaxTableList(mixed $actual, int $expected): void { $settings = new Settings(['MaxTableList' => $actual]); @@ -1310,7 +1305,7 @@ class SettingsTest extends TestCase yield 'invalid value' => [0, 250]; } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testShowHint(mixed $actual, bool $expected): void { $settings = new Settings(['ShowHint' => $actual]); @@ -1320,7 +1315,7 @@ class SettingsTest extends TestCase $this->assertSame($expected, $settingsArray['ShowHint']); } - /** @dataProvider valuesForMaxCharactersInDisplayedSQLProvider */ + #[DataProvider('valuesForMaxCharactersInDisplayedSQLProvider')] public function testMaxCharactersInDisplayedSQL(mixed $actual, int $expected): void { $settings = new Settings(['MaxCharactersInDisplayedSQL' => $actual]); @@ -1339,7 +1334,7 @@ class SettingsTest extends TestCase yield 'invalid value' => [0, 1000]; } - /** @dataProvider valuesForOBGzipProvider */ + #[DataProvider('valuesForOBGzipProvider')] public function testOBGzip(mixed $actual, string|bool $expected): void { $settings = new Settings(['OBGzip' => $actual]); @@ -1359,7 +1354,7 @@ class SettingsTest extends TestCase yield 'valid value with type coercion' => [0, false]; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testPersistentConnections(mixed $actual, bool $expected): void { $settings = new Settings(['PersistentConnections' => $actual]); @@ -1369,7 +1364,7 @@ class SettingsTest extends TestCase $this->assertSame($expected, $settingsArray['PersistentConnections']); } - /** @dataProvider valuesForExecTimeLimitProvider */ + #[DataProvider('valuesForExecTimeLimitProvider')] public function testExecTimeLimit(mixed $actual, int $expected): void { $settings = new Settings(['ExecTimeLimit' => $actual]); @@ -1388,7 +1383,7 @@ class SettingsTest extends TestCase yield 'invalid value' => [-1, 300]; } - /** @dataProvider valuesForSessionSavePathProvider */ + #[DataProvider('valuesForSessionSavePathProvider')] public function testSessionSavePath(mixed $actual, string $expected): void { $settings = new Settings(['SessionSavePath' => $actual]); @@ -1407,7 +1402,7 @@ class SettingsTest extends TestCase yield 'valid value with type coercion' => [1234, '1234']; } - /** @dataProvider booleanWithDefaultFalseProvider */ + #[DataProvider('booleanWithDefaultFalseProvider')] public function testShowAll(mixed $actual, bool $expected): void { $settings = new Settings(['ShowAll' => $actual]); @@ -1426,7 +1421,7 @@ class SettingsTest extends TestCase yield 'valid value with type coercion' => [1, true]; } - /** @dataProvider valuesForMaxRowsProvider */ + #[DataProvider('valuesForMaxRowsProvider')] public function testMaxRows(mixed $actual, int $expected): void { $settings = new Settings(['MaxRows' => $actual]); @@ -1445,7 +1440,7 @@ class SettingsTest extends TestCase yield 'invalid value' => [0, 25]; } - /** @dataProvider valuesForLimitCharsProvider */ + #[DataProvider('valuesForLimitCharsProvider')] public function testLimitChars(mixed $actual, int $expected): void { $settings = new Settings(['LimitChars' => $actual]); @@ -1464,7 +1459,7 @@ class SettingsTest extends TestCase yield 'invalid value' => [0, 50]; } - /** @dataProvider valuesForRepeatCellsProvider */ + #[DataProvider('valuesForRepeatCellsProvider')] public function testRepeatCells(mixed $actual, int $expected): void { $settings = new Settings(['RepeatCells' => $actual]); @@ -1483,7 +1478,7 @@ class SettingsTest extends TestCase yield 'invalid value' => [-1, 100]; } - /** @dataProvider booleanWithDefaultTrueProvider */ + #[DataProvider('booleanWithDefaultTrueProvider')] public function testZeroConf(mixed $actual, bool $expected): void { $settings = new Settings(['ZeroConf' => $actual]); @@ -1502,11 +1497,8 @@ class SettingsTest extends TestCase yield 'valid value with type coercion' => [0, false]; } - /** - * @param array{internal: int, human: string} $expected - * - * @dataProvider valuesForMysqlMinVersionProvider - */ + /** @param array{internal: int, human: string} $expected */ + #[DataProvider('valuesForMysqlMinVersionProvider')] public function testMysqlMinVersion(mixed $actual, array $expected): void { $settings = new Settings(['MysqlMinVersion' => $actual]); diff --git a/test/classes/ConfigStorage/RelationCleanupTest.php b/test/classes/ConfigStorage/RelationCleanupTest.php index a34b3ff74b..a4c507e61c 100644 --- a/test/classes/ConfigStorage/RelationCleanupTest.php +++ b/test/classes/ConfigStorage/RelationCleanupTest.php @@ -10,8 +10,9 @@ use PhpMyAdmin\ConfigStorage\RelationParameters; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Dbal\ResultInterface; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\ConfigStorage\RelationCleanup */ +#[CoversClass(RelationCleanup::class)] class RelationCleanupTest extends AbstractTestCase { public function testColumnWithoutRelations(): void diff --git a/test/classes/ConfigStorage/RelationParametersTest.php b/test/classes/ConfigStorage/RelationParametersTest.php index f23640b7c1..b818c90b28 100644 --- a/test/classes/ConfigStorage/RelationParametersTest.php +++ b/test/classes/ConfigStorage/RelationParametersTest.php @@ -4,32 +4,50 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\ConfigStorage; +use PhpMyAdmin\ConfigStorage\Features\BookmarkFeature; +use PhpMyAdmin\ConfigStorage\Features\BrowserTransformationFeature; +use PhpMyAdmin\ConfigStorage\Features\CentralColumnsFeature; +use PhpMyAdmin\ConfigStorage\Features\ColumnCommentsFeature; +use PhpMyAdmin\ConfigStorage\Features\ConfigurableMenusFeature; +use PhpMyAdmin\ConfigStorage\Features\DatabaseDesignerSettingsFeature; +use PhpMyAdmin\ConfigStorage\Features\DisplayFeature; +use PhpMyAdmin\ConfigStorage\Features\ExportTemplatesFeature; +use PhpMyAdmin\ConfigStorage\Features\FavoriteTablesFeature; +use PhpMyAdmin\ConfigStorage\Features\NavigationItemsHidingFeature; +use PhpMyAdmin\ConfigStorage\Features\PdfFeature; +use PhpMyAdmin\ConfigStorage\Features\RecentlyUsedTablesFeature; +use PhpMyAdmin\ConfigStorage\Features\RelationFeature; +use PhpMyAdmin\ConfigStorage\Features\SavedQueryByExampleSearchesFeature; +use PhpMyAdmin\ConfigStorage\Features\SqlHistoryFeature; +use PhpMyAdmin\ConfigStorage\Features\TrackingFeature; +use PhpMyAdmin\ConfigStorage\Features\UiPreferencesFeature; +use PhpMyAdmin\ConfigStorage\Features\UserPreferencesFeature; use PhpMyAdmin\ConfigStorage\RelationParameters; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Version; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** - * @covers \PhpMyAdmin\ConfigStorage\RelationParameters - * @covers \PhpMyAdmin\ConfigStorage\Features\BookmarkFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\BrowserTransformationFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\CentralColumnsFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\ColumnCommentsFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\ConfigurableMenusFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\DatabaseDesignerSettingsFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\DisplayFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\ExportTemplatesFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\FavoriteTablesFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\NavigationItemsHidingFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\PdfFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\RecentlyUsedTablesFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\RelationFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\SavedQueryByExampleSearchesFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\SqlHistoryFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\TrackingFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\UiPreferencesFeature - * @covers \PhpMyAdmin\ConfigStorage\Features\UserPreferencesFeature - */ +#[CoversClass(RelationParameters::class)] +#[CoversClass(BookmarkFeature::class)] +#[CoversClass(BrowserTransformationFeature::class)] +#[CoversClass(CentralColumnsFeature::class)] +#[CoversClass(ColumnCommentsFeature::class)] +#[CoversClass(ConfigurableMenusFeature::class)] +#[CoversClass(DatabaseDesignerSettingsFeature::class)] +#[CoversClass(DisplayFeature::class)] +#[CoversClass(ExportTemplatesFeature::class)] +#[CoversClass(FavoriteTablesFeature::class)] +#[CoversClass(NavigationItemsHidingFeature::class)] +#[CoversClass(PdfFeature::class)] +#[CoversClass(RecentlyUsedTablesFeature::class)] +#[CoversClass(RelationFeature::class)] +#[CoversClass(SavedQueryByExampleSearchesFeature::class)] +#[CoversClass(SqlHistoryFeature::class)] +#[CoversClass(TrackingFeature::class)] +#[CoversClass(UiPreferencesFeature::class)] +#[CoversClass(UserPreferencesFeature::class)] class RelationParametersTest extends TestCase { public function testFeaturesWithTwoTables(): void @@ -246,9 +264,8 @@ class RelationParametersTest extends TestCase /** * @param mixed[] $params * @param mixed[] $expected - * - * @dataProvider providerForTestToArray */ + #[DataProvider('providerForTestToArray')] public function testToArray(array $params, array $expected): void { $this->assertSame($expected, RelationParameters::fromArray($params)->toArray()); diff --git a/test/classes/ConfigStorage/RelationTest.php b/test/classes/ConfigStorage/RelationTest.php index 4f4f7fa3d0..315a46ccdb 100644 --- a/test/classes/ConfigStorage/RelationTest.php +++ b/test/classes/ConfigStorage/RelationTest.php @@ -10,14 +10,15 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\RecentFavoriteTable; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use function implode; -/** - * @covers \PhpMyAdmin\ConfigStorage\Relation - * @group medium - */ +#[CoversClass(Relation::class)] +#[Group('medium')] class RelationTest extends AbstractTestCase { /** @@ -2162,9 +2163,8 @@ class RelationTest extends AbstractTestCase /** * @param array $params * @param string[] $queries - * - * @dataProvider providerForTestRenameTable */ + #[DataProvider('providerForTestRenameTable')] public function testRenameTable(array $params, array $queries): void { $dummyDbi = $this->createDbiDummy(); diff --git a/test/classes/ConfigStorage/UserGroupsTest.php b/test/classes/ConfigStorage/UserGroupsTest.php index 8984253fef..000d1c968d 100644 --- a/test/classes/ConfigStorage/UserGroupsTest.php +++ b/test/classes/ConfigStorage/UserGroupsTest.php @@ -15,8 +15,10 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; -/** @covers \PhpMyAdmin\ConfigStorage\UserGroups */ +#[CoversClass(UserGroups::class)] class UserGroupsTest extends AbstractTestCase { private ConfigurableMenusFeature $configurableMenusFeature; @@ -41,9 +43,8 @@ class UserGroupsTest extends AbstractTestCase /** * Tests UserGroups::getHtmlForUserGroupsTable() function when there are no user groups - * - * @group medium */ + #[Group('medium')] public function testGetHtmlForUserGroupsTableWithNoUserGroups(): void { $expectedQuery = 'SELECT * FROM `pmadb`.`usergroups` ORDER BY `usergroup` ASC'; diff --git a/test/classes/ConfigTest.php b/test/classes/ConfigTest.php index 6446c1980c..649aeccc63 100644 --- a/test/classes/ConfigTest.php +++ b/test/classes/ConfigTest.php @@ -8,6 +8,10 @@ use PhpMyAdmin\Config; use PhpMyAdmin\Config\Settings; use PhpMyAdmin\Config\Settings\Server; use PhpMyAdmin\Dbal\Connection; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Depends; +use PHPUnit\Framework\Attributes\Group; use function define; use function defined; @@ -36,10 +40,8 @@ use const INFO_MODULES; use const PHP_OS; use const TEST_PATH; -/** - * @covers \PhpMyAdmin\Config - * @psalm-import-type ConnectionType from Connection - */ +/** @psalm-import-type ConnectionType from Connection */ +#[CoversClass(Config::class)] class ConfigTest extends AbstractTestCase { protected Config $object; @@ -126,9 +128,8 @@ PHP; /** * Test for CheckSystem - * - * @group medium */ + #[Group('medium')] public function testCheckSystem(): void { $this->object->checkSystem(); @@ -162,9 +163,8 @@ PHP; * @param string $os Expected parsed OS (or null if none) * @param string $browser Expected parsed browser (or null if none) * @param string $version Expected browser version (or null if none) - * - * @dataProvider userAgentProvider */ + #[DataProvider('userAgentProvider')] public function testCheckClient( string $agent, string $os, @@ -323,9 +323,8 @@ PHP; * * @param string $server Server identification * @param int $iis Whether server should be detected as IIS - * - * @dataProvider serverNames */ + #[DataProvider('serverNames')] public function testCheckWebServer(string $server, int $iis): void { $_SERVER['SERVER_SOFTWARE'] = $server; @@ -442,9 +441,8 @@ PHP; * @param string $pmaAbsoluteUri phpMyAdmin absolute URI * @param int $port server port * @param bool $expected expected result - * - * @dataProvider httpsParams */ + #[DataProvider('httpsParams')] public function testIsHttps( string $scheme, string $https, @@ -518,9 +516,8 @@ PHP; * @param string $request The request URL used for phpMyAdmin * @param string $absolute The absolute URL used for phpMyAdmin * @param string $expected Expected root path - * - * @dataProvider rootUris */ + #[DataProvider('rootUris')] public function testGetRootPath(string $request, string $absolute, string $expected): void { $_SERVER['PHP_SELF'] = $request; @@ -556,9 +553,8 @@ PHP; * * @param string $source File name of config to load * @param bool $result Expected result of loading - * - * @dataProvider configPaths */ + #[DataProvider('configPaths')] public function testLoad(string $source, bool $result): void { if ($result) { @@ -667,9 +663,8 @@ PHP; /** * Test for getTempDir - * - * @group file-system */ + #[Group('file-system')] public function testGetTempDir(): void { $dir = realpath(sys_get_temp_dir()); @@ -687,10 +682,9 @@ PHP; /** * Test for getUploadTempDir - * - * @group file-system - * @depends testGetTempDir */ + #[Depends('testGetTempDir')] + #[Group('file-system')] public function testGetUploadTempDir(): void { $dir = realpath(sys_get_temp_dir()); @@ -712,9 +706,8 @@ PHP; * @param mixed[] $settings settings array * @param string|mixed[] $request request * @param int $expected expected result - * - * @dataProvider selectServerProvider */ + #[DataProvider('selectServerProvider')] public function testSelectServer(array $settings, string|array $request, int $expected): void { $config = new Config(); @@ -756,9 +749,8 @@ PHP; * @param mixed[] $serverCfg Server configuration * @param mixed[] $expected Expected result * @psalm-param ConnectionType $connectionType - * - * @dataProvider connectionParams */ + #[DataProvider('connectionParams')] public function testGetConnectionParams(array $serverCfg, int $connectionType, array $expected): void { $result = Config::getConnectionParams(new Server($serverCfg), $connectionType); @@ -894,11 +886,8 @@ PHP; ]; } - /** - * @psalm-param ConnectionType $connectionType - * - * @dataProvider connectionParamsWhenConnectionIsUserOrAuxiliaryProvider - */ + /** @psalm-param ConnectionType $connectionType */ + #[DataProvider('connectionParamsWhenConnectionIsUserOrAuxiliaryProvider')] public function testGetConnectionParamsWhenConnectionIsUserOrAuxiliary( int $connectionType, string $host, diff --git a/test/classes/ConsoleTest.php b/test/classes/ConsoleTest.php index a4e6e0fb93..bb3075b403 100644 --- a/test/classes/ConsoleTest.php +++ b/test/classes/ConsoleTest.php @@ -7,9 +7,10 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Console; use PhpMyAdmin\Template; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionProperty; -/** @covers \PhpMyAdmin\Console */ +#[CoversClass(Console::class)] class ConsoleTest extends AbstractTestCase { public function testGetScripts(): void diff --git a/test/classes/Controllers/AbstractControllerTest.php b/test/classes/Controllers/AbstractControllerTest.php index 7b7bc52660..e7291a0283 100644 --- a/test/classes/Controllers/AbstractControllerTest.php +++ b/test/classes/Controllers/AbstractControllerTest.php @@ -11,9 +11,10 @@ use PhpMyAdmin\Message; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use Throwable; -/** @covers \PhpMyAdmin\Controllers\AbstractController */ +#[CoversClass(AbstractController::class)] class AbstractControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/CheckRelationsControllerTest.php b/test/classes/Controllers/CheckRelationsControllerTest.php index 28598efb3d..afec8c7467 100644 --- a/test/classes/Controllers/CheckRelationsControllerTest.php +++ b/test/classes/Controllers/CheckRelationsControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\CheckRelationsController */ +#[CoversClass(CheckRelationsController::class)] class CheckRelationsControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/CollationConnectionControllerTest.php b/test/classes/Controllers/CollationConnectionControllerTest.php index 4fc4abb510..48a2ff10a9 100644 --- a/test/classes/Controllers/CollationConnectionControllerTest.php +++ b/test/classes/Controllers/CollationConnectionControllerTest.php @@ -11,8 +11,9 @@ use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\CollationConnectionController */ +#[CoversClass(CollationConnectionController::class)] class CollationConnectionControllerTest extends AbstractTestCase { public function testInvoke(): void diff --git a/test/classes/Controllers/Console/Bookmark/AddControllerTest.php b/test/classes/Controllers/Console/Bookmark/AddControllerTest.php index decdb616e5..0fe97f8167 100644 --- a/test/classes/Controllers/Console/Bookmark/AddControllerTest.php +++ b/test/classes/Controllers/Console/Bookmark/AddControllerTest.php @@ -11,9 +11,10 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; -/** @covers \PhpMyAdmin\Controllers\Console\Bookmark\AddController */ +#[CoversClass(AddController::class)] class AddControllerTest extends AbstractTestCase { public function testWithInvalidParams(): void diff --git a/test/classes/Controllers/Console/Bookmark/RefreshControllerTest.php b/test/classes/Controllers/Console/Bookmark/RefreshControllerTest.php index 5f7e6bf6be..3e56198ef4 100644 --- a/test/classes/Controllers/Console/Bookmark/RefreshControllerTest.php +++ b/test/classes/Controllers/Console/Bookmark/RefreshControllerTest.php @@ -9,8 +9,9 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Console\Bookmark\RefreshController */ +#[CoversClass(RefreshController::class)] class RefreshControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Database/EventsControllerTest.php b/test/classes/Controllers/Database/EventsControllerTest.php index b4715bdc73..8f18aea182 100644 --- a/test/classes/Controllers/Database/EventsControllerTest.php +++ b/test/classes/Controllers/Database/EventsControllerTest.php @@ -10,11 +10,10 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** - * @covers \PhpMyAdmin\Controllers\Database\EventsController - * @covers \PhpMyAdmin\Database\Events - */ +#[CoversClass(EventsController::class)] +#[CoversClass(Events::class)] final class EventsControllerTest extends AbstractTestCase { public function testWithEvents(): void diff --git a/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php b/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php index 9b05364755..f39066dd2c 100644 --- a/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php +++ b/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php @@ -9,8 +9,9 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Database\MultiTableQuery\TablesController */ +#[CoversClass(TablesController::class)] class TablesControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Database/PrivilegesControllerTest.php b/test/classes/Controllers/Database/PrivilegesControllerTest.php index 758b8f7711..c28b7f272a 100644 --- a/test/classes/Controllers/Database/PrivilegesControllerTest.php +++ b/test/classes/Controllers/Database/PrivilegesControllerTest.php @@ -13,10 +13,11 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; use function __; -/** @covers \PhpMyAdmin\Controllers\Database\PrivilegesController */ +#[CoversClass(PrivilegesController::class)] class PrivilegesControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Database/RoutinesControllerTest.php b/test/classes/Controllers/Database/RoutinesControllerTest.php index 43556e2c24..8ccc84a4d0 100644 --- a/test/classes/Controllers/Database/RoutinesControllerTest.php +++ b/test/classes/Controllers/Database/RoutinesControllerTest.php @@ -11,11 +11,10 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** - * @covers \PhpMyAdmin\Controllers\Database\RoutinesController - * @covers \PhpMyAdmin\Database\Routines - */ +#[CoversClass(RoutinesController::class)] +#[CoversClass(Routines::class)] final class RoutinesControllerTest extends AbstractTestCase { public function testWithRoutines(): void diff --git a/test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php b/test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php index 5cd1d6c64f..35eec6fb63 100644 --- a/test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php +++ b/test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php @@ -12,11 +12,12 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; use function json_encode; -/** @covers \PhpMyAdmin\Controllers\Database\Structure\FavoriteTableController */ +#[CoversClass(FavoriteTableController::class)] class FavoriteTableControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php b/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php index 5b4ba0e51b..a4dd5b7af6 100644 --- a/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php +++ b/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php @@ -11,10 +11,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub; +use PHPUnit\Framework\Attributes\CoversClass; use function json_encode; -/** @covers \PhpMyAdmin\Controllers\Database\Structure\RealRowCountController */ +#[CoversClass(RealRowCountController::class)] class RealRowCountControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Database/StructureControllerTest.php b/test/classes/Controllers/Database/StructureControllerTest.php index 67aab7cf2a..876943f0ae 100644 --- a/test/classes/Controllers/Database/StructureControllerTest.php +++ b/test/classes/Controllers/Database/StructureControllerTest.php @@ -14,10 +14,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub; use PhpMyAdmin\Tracking\TrackingChecker; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; use ReflectionException; -/** @covers \PhpMyAdmin\Controllers\Database\StructureController */ +#[CoversClass(StructureController::class)] class StructureControllerTest extends AbstractTestCase { private ResponseStub $response; diff --git a/test/classes/Controllers/Export/ExportControllerTest.php b/test/classes/Controllers/Export/ExportControllerTest.php index 8d42a3e703..d1bf9a5387 100644 --- a/test/classes/Controllers/Export/ExportControllerTest.php +++ b/test/classes/Controllers/Export/ExportControllerTest.php @@ -13,6 +13,7 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\FieldHelper; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use function htmlspecialchars; @@ -23,7 +24,7 @@ use const MYSQLI_TYPE_DATETIME; use const MYSQLI_TYPE_DECIMAL; use const MYSQLI_TYPE_STRING; -/** @covers \PhpMyAdmin\Controllers\Export\ExportController */ +#[CoversClass(ExportController::class)] class ExportControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Export/Template/CreateControllerTest.php b/test/classes/Controllers/Export/Template/CreateControllerTest.php index 8fb1f82362..19fcdb1903 100644 --- a/test/classes/Controllers/Export/Template/CreateControllerTest.php +++ b/test/classes/Controllers/Export/Template/CreateControllerTest.php @@ -15,9 +15,10 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; -/** @covers \PhpMyAdmin\Controllers\Export\Template\CreateController */ +#[CoversClass(CreateController::class)] class CreateControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Export/Template/DeleteControllerTest.php b/test/classes/Controllers/Export/Template/DeleteControllerTest.php index ec9ca7a658..d34b36f320 100644 --- a/test/classes/Controllers/Export/Template/DeleteControllerTest.php +++ b/test/classes/Controllers/Export/Template/DeleteControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Export\Template\DeleteController */ +#[CoversClass(DeleteController::class)] class DeleteControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Export/Template/LoadControllerTest.php b/test/classes/Controllers/Export/Template/LoadControllerTest.php index b88789574e..3d91a79d51 100644 --- a/test/classes/Controllers/Export/Template/LoadControllerTest.php +++ b/test/classes/Controllers/Export/Template/LoadControllerTest.php @@ -14,9 +14,10 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; -/** @covers \PhpMyAdmin\Controllers\Export\Template\LoadController */ +#[CoversClass(LoadController::class)] class LoadControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Export/Template/UpdateControllerTest.php b/test/classes/Controllers/Export/Template/UpdateControllerTest.php index 9b3a340ddd..387b0219ba 100644 --- a/test/classes/Controllers/Export/Template/UpdateControllerTest.php +++ b/test/classes/Controllers/Export/Template/UpdateControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Export\Template\UpdateController */ +#[CoversClass(UpdateController::class)] class UpdateControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/GisDataEditorControllerTest.php b/test/classes/Controllers/GisDataEditorControllerTest.php index 958551965d..b9efc68f43 100644 --- a/test/classes/Controllers/GisDataEditorControllerTest.php +++ b/test/classes/Controllers/GisDataEditorControllerTest.php @@ -8,8 +8,11 @@ use PhpMyAdmin\Controllers\GisDataEditorController; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; -/** @covers \PhpMyAdmin\Controllers\GisDataEditorController */ +#[CoversClass(GisDataEditorController::class)] class GisDataEditorControllerTest extends AbstractTestCase { private GisDataEditorController|null $controller = null; @@ -32,10 +35,9 @@ class GisDataEditorControllerTest extends AbstractTestCase /** * @param mixed[] $gisData * @param mixed[] $expected - * - * @group gis - * @dataProvider providerForTestValidateGisData */ + #[DataProvider('providerForTestValidateGisData')] + #[Group('gis')] public function testValidateGisData(array $gisData, string $type, string|null $value, array $expected): void { /** @var mixed[] $gisData */ diff --git a/test/classes/Controllers/Import/ImportControllerTest.php b/test/classes/Controllers/Import/ImportControllerTest.php index adb5b7b39e..b2c1f50e72 100644 --- a/test/classes/Controllers/Import/ImportControllerTest.php +++ b/test/classes/Controllers/Import/ImportControllerTest.php @@ -9,8 +9,9 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Import\ImportController */ +#[CoversClass(ImportController::class)] class ImportControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/JavaScriptMessagesControllerTest.php b/test/classes/Controllers/JavaScriptMessagesControllerTest.php index 89de6e7f13..01f0c73876 100644 --- a/test/classes/Controllers/JavaScriptMessagesControllerTest.php +++ b/test/classes/Controllers/JavaScriptMessagesControllerTest.php @@ -5,16 +5,18 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Controllers; use PhpMyAdmin\Controllers\JavaScriptMessagesController; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use PHPUnit\Framework\TestCase; use function json_decode; use function strlen; use function substr; -/** @covers \PhpMyAdmin\Controllers\JavaScriptMessagesController */ +#[CoversClass(JavaScriptMessagesController::class)] class JavaScriptMessagesControllerTest extends TestCase { - /** @runInSeparateProcess */ + #[RunInSeparateProcess] public function testIndex(): void { (new JavaScriptMessagesController())(); diff --git a/test/classes/Controllers/LintControllerTest.php b/test/classes/Controllers/LintControllerTest.php index 95ec21786c..d547d4bf9f 100644 --- a/test/classes/Controllers/LintControllerTest.php +++ b/test/classes/Controllers/LintControllerTest.php @@ -9,13 +9,13 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use function json_encode; -/** - * @covers \PhpMyAdmin\Controllers\LintController - * @runTestsInSeparateProcesses - */ +#[CoversClass(LintController::class)] +#[RunTestsInSeparateProcesses] class LintControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/LogoutControllerTest.php b/test/classes/Controllers/LogoutControllerTest.php index 04d87250a6..ad016c7694 100644 --- a/test/classes/Controllers/LogoutControllerTest.php +++ b/test/classes/Controllers/LogoutControllerTest.php @@ -9,8 +9,9 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Plugins\AuthenticationPlugin; use PhpMyAdmin\Plugins\AuthenticationPluginFactory; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\LogoutController */ +#[CoversClass(LogoutController::class)] class LogoutControllerTest extends AbstractTestCase { public function testValidLogout(): void diff --git a/test/classes/Controllers/NavigationControllerTest.php b/test/classes/Controllers/NavigationControllerTest.php index fdc9d18ef8..8a211e5087 100644 --- a/test/classes/Controllers/NavigationControllerTest.php +++ b/test/classes/Controllers/NavigationControllerTest.php @@ -9,10 +9,11 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; use function sprintf; -/** @covers \PhpMyAdmin\Controllers\NavigationController */ +#[CoversClass(NavigationController::class)] class NavigationControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Normalization/AddNewPrimaryControllerTest.php b/test/classes/Controllers/Normalization/AddNewPrimaryControllerTest.php index ff64683ca3..c26232ea18 100644 --- a/test/classes/Controllers/Normalization/AddNewPrimaryControllerTest.php +++ b/test/classes/Controllers/Normalization/AddNewPrimaryControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Normalization\AddNewPrimaryController */ +#[CoversClass(AddNewPrimaryController::class)] class AddNewPrimaryControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/CreateNewColumnControllerTest.php b/test/classes/Controllers/Normalization/CreateNewColumnControllerTest.php index 5be86c64a4..780e59f2d5 100644 --- a/test/classes/Controllers/Normalization/CreateNewColumnControllerTest.php +++ b/test/classes/Controllers/Normalization/CreateNewColumnControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Normalization\CreateNewColumnController */ +#[CoversClass(CreateNewColumnController::class)] class CreateNewColumnControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/FirstNormalForm/FirstStepControllerTest.php b/test/classes/Controllers/Normalization/FirstNormalForm/FirstStepControllerTest.php index 5063bf7929..b9ef9b16e9 100644 --- a/test/classes/Controllers/Normalization/FirstNormalForm/FirstStepControllerTest.php +++ b/test/classes/Controllers/Normalization/FirstNormalForm/FirstStepControllerTest.php @@ -12,17 +12,16 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function in_array; -/** @covers \PhpMyAdmin\Controllers\Normalization\FirstNormalForm\FirstStepController */ +#[CoversClass(FirstStepController::class)] class FirstStepControllerTest extends AbstractTestCase { - /** - * @psalm-param '1nf'|'2nf'|'3nf' $expectedNormalizeTo - * - * @dataProvider providerForTestDefault - */ + /** @psalm-param '1nf'|'2nf'|'3nf' $expectedNormalizeTo */ + #[DataProvider('providerForTestDefault')] public function testDefault(string|null $normalizeTo, string $expectedNormalizeTo): void { $GLOBALS['db'] = 'test_db'; diff --git a/test/classes/Controllers/Normalization/FirstNormalForm/FourthStepControllerTest.php b/test/classes/Controllers/Normalization/FirstNormalForm/FourthStepControllerTest.php index 741345a2d7..7cc7f7c6b2 100644 --- a/test/classes/Controllers/Normalization/FirstNormalForm/FourthStepControllerTest.php +++ b/test/classes/Controllers/Normalization/FirstNormalForm/FourthStepControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Normalization\FirstNormalForm\FourthStepController */ +#[CoversClass(FourthStepController::class)] class FourthStepControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/FirstNormalForm/SecondStepControllerTest.php b/test/classes/Controllers/Normalization/FirstNormalForm/SecondStepControllerTest.php index 975ec091da..dbbbc13960 100644 --- a/test/classes/Controllers/Normalization/FirstNormalForm/SecondStepControllerTest.php +++ b/test/classes/Controllers/Normalization/FirstNormalForm/SecondStepControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Normalization\FirstNormalForm\SecondStepController */ +#[CoversClass(SecondStepController::class)] class SecondStepControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/FirstNormalForm/ThirdStepControllerTest.php b/test/classes/Controllers/Normalization/FirstNormalForm/ThirdStepControllerTest.php index 6b64c5f8e0..901cd75490 100644 --- a/test/classes/Controllers/Normalization/FirstNormalForm/ThirdStepControllerTest.php +++ b/test/classes/Controllers/Normalization/FirstNormalForm/ThirdStepControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Normalization\FirstNormalForm\ThirdStepController */ +#[CoversClass(ThirdStepController::class)] class ThirdStepControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/GetColumnsControllerTest.php b/test/classes/Controllers/Normalization/GetColumnsControllerTest.php index afaf91485b..7a20542450 100644 --- a/test/classes/Controllers/Normalization/GetColumnsControllerTest.php +++ b/test/classes/Controllers/Normalization/GetColumnsControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Normalization\GetColumnsController */ +#[CoversClass(GetColumnsController::class)] class GetColumnsControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/MainControllerTest.php b/test/classes/Controllers/Normalization/MainControllerTest.php index 69ccededab..935070a624 100644 --- a/test/classes/Controllers/Normalization/MainControllerTest.php +++ b/test/classes/Controllers/Normalization/MainControllerTest.php @@ -11,10 +11,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use function in_array; -/** @covers \PhpMyAdmin\Controllers\Normalization\MainController */ +#[CoversClass(MainController::class)] class MainControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Normalization/MoveRepeatingGroupTest.php b/test/classes/Controllers/Normalization/MoveRepeatingGroupTest.php index 688d1ed3fc..8fef3c52fc 100644 --- a/test/classes/Controllers/Normalization/MoveRepeatingGroupTest.php +++ b/test/classes/Controllers/Normalization/MoveRepeatingGroupTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Normalization\MoveRepeatingGroup */ +#[CoversClass(MoveRepeatingGroup::class)] class MoveRepeatingGroupTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/PartialDependenciesControllerTest.php b/test/classes/Controllers/Normalization/PartialDependenciesControllerTest.php index cc2ecbb336..523e4ee95c 100644 --- a/test/classes/Controllers/Normalization/PartialDependenciesControllerTest.php +++ b/test/classes/Controllers/Normalization/PartialDependenciesControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Normalization\PartialDependenciesController */ +#[CoversClass(PartialDependenciesController::class)] class PartialDependenciesControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/SecondNormalForm/CreateNewTablesControllerTest.php b/test/classes/Controllers/Normalization/SecondNormalForm/CreateNewTablesControllerTest.php index b614421360..133c720834 100644 --- a/test/classes/Controllers/Normalization/SecondNormalForm/CreateNewTablesControllerTest.php +++ b/test/classes/Controllers/Normalization/SecondNormalForm/CreateNewTablesControllerTest.php @@ -12,10 +12,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; use function json_encode; -/** @covers \PhpMyAdmin\Controllers\Normalization\SecondNormalForm\CreateNewTablesController */ +#[CoversClass(CreateNewTablesController::class)] class CreateNewTablesControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/SecondNormalForm/FirstStepControllerTest.php b/test/classes/Controllers/Normalization/SecondNormalForm/FirstStepControllerTest.php index eef51c5d55..5a94015353 100644 --- a/test/classes/Controllers/Normalization/SecondNormalForm/FirstStepControllerTest.php +++ b/test/classes/Controllers/Normalization/SecondNormalForm/FirstStepControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Normalization\SecondNormalForm\FirstStepController */ +#[CoversClass(FirstStepController::class)] class FirstStepControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/SecondNormalForm/NewTablesControllerTest.php b/test/classes/Controllers/Normalization/SecondNormalForm/NewTablesControllerTest.php index 33c38548cc..7acbc5c199 100644 --- a/test/classes/Controllers/Normalization/SecondNormalForm/NewTablesControllerTest.php +++ b/test/classes/Controllers/Normalization/SecondNormalForm/NewTablesControllerTest.php @@ -12,10 +12,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; use function json_encode; -/** @covers \PhpMyAdmin\Controllers\Normalization\SecondNormalForm\NewTablesController */ +#[CoversClass(NewTablesController::class)] class NewTablesControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/ThirdNormalForm/CreateNewTablesControllerTest.php b/test/classes/Controllers/Normalization/ThirdNormalForm/CreateNewTablesControllerTest.php index 63cce12eb5..f9c67f498a 100644 --- a/test/classes/Controllers/Normalization/ThirdNormalForm/CreateNewTablesControllerTest.php +++ b/test/classes/Controllers/Normalization/ThirdNormalForm/CreateNewTablesControllerTest.php @@ -12,10 +12,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; use function json_encode; -/** @covers \PhpMyAdmin\Controllers\Normalization\ThirdNormalForm\CreateNewTablesController */ +#[CoversClass(CreateNewTablesController::class)] class CreateNewTablesControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/ThirdNormalForm/FirstStepControllerTest.php b/test/classes/Controllers/Normalization/ThirdNormalForm/FirstStepControllerTest.php index 0228d1947f..3003a6b39b 100644 --- a/test/classes/Controllers/Normalization/ThirdNormalForm/FirstStepControllerTest.php +++ b/test/classes/Controllers/Normalization/ThirdNormalForm/FirstStepControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Normalization\ThirdNormalForm\FirstStepController */ +#[CoversClass(FirstStepController::class)] class FirstStepControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/Normalization/ThirdNormalForm/NewTablesControllerTest.php b/test/classes/Controllers/Normalization/ThirdNormalForm/NewTablesControllerTest.php index c248e3f5dd..c26040e3c9 100644 --- a/test/classes/Controllers/Normalization/ThirdNormalForm/NewTablesControllerTest.php +++ b/test/classes/Controllers/Normalization/ThirdNormalForm/NewTablesControllerTest.php @@ -12,10 +12,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; use function json_encode; -/** @covers \PhpMyAdmin\Controllers\Normalization\ThirdNormalForm\NewTablesController */ +#[CoversClass(NewTablesController::class)] class NewTablesControllerTest extends AbstractTestCase { public function testDefault(): void diff --git a/test/classes/Controllers/SchemaExportControllerTest.php b/test/classes/Controllers/SchemaExportControllerTest.php index 31413bedaa..db01b5b844 100644 --- a/test/classes/Controllers/SchemaExportControllerTest.php +++ b/test/classes/Controllers/SchemaExportControllerTest.php @@ -9,11 +9,13 @@ use PhpMyAdmin\Export; use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; -/** @covers \PhpMyAdmin\Controllers\SchemaExportController */ +#[CoversClass(SchemaExportController::class)] class SchemaExportControllerTest extends AbstractTestCase { - /** @runInSeparateProcess */ + #[RunInSeparateProcess] public function testExport(): void { $GLOBALS['dbi'] = $this->createDatabaseInterface(); diff --git a/test/classes/Controllers/Server/BinlogControllerTest.php b/test/classes/Controllers/Server/BinlogControllerTest.php index cd1d61524c..abce5116ea 100644 --- a/test/classes/Controllers/Server/BinlogControllerTest.php +++ b/test/classes/Controllers/Server/BinlogControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Url; use PhpMyAdmin\Utils\SessionCache; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\BinlogController */ +#[CoversClass(BinlogController::class)] class BinlogControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/CollationsControllerTest.php b/test/classes/Controllers/Server/CollationsControllerTest.php index 729838cc33..5a0c9064b6 100644 --- a/test/classes/Controllers/Server/CollationsControllerTest.php +++ b/test/classes/Controllers/Server/CollationsControllerTest.php @@ -11,8 +11,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\CollationsController */ +#[CoversClass(CollationsController::class)] class CollationsControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/Databases/CreateControllerTest.php b/test/classes/Controllers/Server/Databases/CreateControllerTest.php index 8e6257e8cc..2b5ca71f7d 100644 --- a/test/classes/Controllers/Server/Databases/CreateControllerTest.php +++ b/test/classes/Controllers/Server/Databases/CreateControllerTest.php @@ -11,11 +11,12 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use function __; use function sprintf; -/** @covers \PhpMyAdmin\Controllers\Server\Databases\CreateController */ +#[CoversClass(CreateController::class)] final class CreateControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/Databases/DestroyControllerTest.php b/test/classes/Controllers/Server/Databases/DestroyControllerTest.php index 5abd52f939..e85f068c3c 100644 --- a/test/classes/Controllers/Server/Databases/DestroyControllerTest.php +++ b/test/classes/Controllers/Server/Databases/DestroyControllerTest.php @@ -13,10 +13,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; use function __; -/** @covers \PhpMyAdmin\Controllers\Server\Databases\DestroyController */ +#[CoversClass(DestroyController::class)] class DestroyControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/Server/DatabasesControllerTest.php b/test/classes/Controllers/Server/DatabasesControllerTest.php index ccd5134543..7be9b441f0 100644 --- a/test/classes/Controllers/Server/DatabasesControllerTest.php +++ b/test/classes/Controllers/Server/DatabasesControllerTest.php @@ -11,10 +11,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use function __; -/** @covers \PhpMyAdmin\Controllers\Server\DatabasesController */ +#[CoversClass(DatabasesController::class)] class DatabasesControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/EnginesControllerTest.php b/test/classes/Controllers/Server/EnginesControllerTest.php index fc73e760a6..03cfe89bbc 100644 --- a/test/classes/Controllers/Server/EnginesControllerTest.php +++ b/test/classes/Controllers/Server/EnginesControllerTest.php @@ -11,8 +11,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\EnginesController */ +#[CoversClass(EnginesController::class)] class EnginesControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/PluginsControllerTest.php b/test/classes/Controllers/Server/PluginsControllerTest.php index 95cdc5d7c3..34c479fabf 100644 --- a/test/classes/Controllers/Server/PluginsControllerTest.php +++ b/test/classes/Controllers/Server/PluginsControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\PluginsController */ +#[CoversClass(PluginsController::class)] class PluginsControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/Privileges/AccountLockControllerTest.php b/test/classes/Controllers/Server/Privileges/AccountLockControllerTest.php index 6695ddf6a8..a0c7dbe684 100644 --- a/test/classes/Controllers/Server/Privileges/AccountLockControllerTest.php +++ b/test/classes/Controllers/Server/Privileges/AccountLockControllerTest.php @@ -13,9 +13,10 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\Stub; -/** @covers \PhpMyAdmin\Controllers\Server\Privileges\AccountLockController */ +#[CoversClass(AccountLockController::class)] class AccountLockControllerTest extends AbstractTestCase { /** @var DatabaseInterface&Stub */ diff --git a/test/classes/Controllers/Server/Privileges/AccountUnlockControllerTest.php b/test/classes/Controllers/Server/Privileges/AccountUnlockControllerTest.php index dbd4c96cbf..211b415c05 100644 --- a/test/classes/Controllers/Server/Privileges/AccountUnlockControllerTest.php +++ b/test/classes/Controllers/Server/Privileges/AccountUnlockControllerTest.php @@ -13,9 +13,10 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\Stub; -/** @covers \PhpMyAdmin\Controllers\Server\Privileges\AccountUnlockController */ +#[CoversClass(AccountUnlockController::class)] class AccountUnlockControllerTest extends AbstractTestCase { /** @var DatabaseInterface&Stub */ diff --git a/test/classes/Controllers/Server/PrivilegesControllerTest.php b/test/classes/Controllers/Server/PrivilegesControllerTest.php index 8fd5f6ea88..3746da6172 100644 --- a/test/classes/Controllers/Server/PrivilegesControllerTest.php +++ b/test/classes/Controllers/Server/PrivilegesControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\PrivilegesController */ +#[CoversClass(PrivilegesController::class)] class PrivilegesControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/ShowEngineControllerTest.php b/test/classes/Controllers/Server/ShowEngineControllerTest.php index faa804fe92..41c3b422dd 100644 --- a/test/classes/Controllers/Server/ShowEngineControllerTest.php +++ b/test/classes/Controllers/Server/ShowEngineControllerTest.php @@ -13,11 +13,12 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use function __; use function htmlspecialchars; -/** @covers \PhpMyAdmin\Controllers\Server\ShowEngineController */ +#[CoversClass(ShowEngineController::class)] class ShowEngineControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/Status/AdvisorControllerTest.php b/test/classes/Controllers/Server/Status/AdvisorControllerTest.php index 3ebc9ab4ec..dd163a88dd 100644 --- a/test/classes/Controllers/Server/Status/AdvisorControllerTest.php +++ b/test/classes/Controllers/Server/Status/AdvisorControllerTest.php @@ -11,9 +11,10 @@ use PhpMyAdmin\Server\Status\Data; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -/** @covers \PhpMyAdmin\Controllers\Server\Status\AdvisorController */ +#[CoversClass(AdvisorController::class)] class AdvisorControllerTest extends AbstractTestCase { private ResponseRenderer $response; diff --git a/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php index dc468d9bc0..fff2af5df1 100644 --- a/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\Status\Monitor\GeneralLogController */ +#[CoversClass(GeneralLogController::class)] class GeneralLogControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php index 0ef268a1b3..bc94befb9e 100644 --- a/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\Status\Monitor\LogVarsController */ +#[CoversClass(LogVarsController::class)] class LogVarsControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php index c4b6ff91b4..b88fc357b5 100644 --- a/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Utils\SessionCache; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\Status\Monitor\QueryAnalyzerController */ +#[CoversClass(QueryAnalyzerController::class)] class QueryAnalyzerControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php index c457a07fa6..1634c76b2d 100644 --- a/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\Status\Monitor\SlowLogController */ +#[CoversClass(SlowLogController::class)] class SlowLogControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/Status/MonitorControllerTest.php b/test/classes/Controllers/Server/Status/MonitorControllerTest.php index 963f7b9374..e24fa5740e 100644 --- a/test/classes/Controllers/Server/Status/MonitorControllerTest.php +++ b/test/classes/Controllers/Server/Status/MonitorControllerTest.php @@ -12,10 +12,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use function __; -/** @covers \PhpMyAdmin\Controllers\Server\Status\MonitorController */ +#[CoversClass(MonitorController::class)] class MonitorControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php b/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php index 2e4a9ce3c6..8d341ae6b8 100644 --- a/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php +++ b/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php @@ -12,11 +12,12 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; use function __; use function htmlspecialchars; -/** @covers \PhpMyAdmin\Controllers\Server\Status\Processes\RefreshController */ +#[CoversClass(RefreshController::class)] class RefreshControllerTest extends AbstractTestCase { private Data $data; diff --git a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php index bf5d58c286..bab59255ef 100644 --- a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php +++ b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\Status\ProcessesController */ +#[CoversClass(ProcessesController::class)] class ProcessesControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/Status/QueriesControllerTest.php b/test/classes/Controllers/Server/Status/QueriesControllerTest.php index d998d066a2..8a14a36c03 100644 --- a/test/classes/Controllers/Server/Status/QueriesControllerTest.php +++ b/test/classes/Controllers/Server/Status/QueriesControllerTest.php @@ -13,12 +13,13 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Util; +use PHPUnit\Framework\Attributes\CoversClass; use function __; use function array_sum; use function htmlspecialchars; -/** @covers \PhpMyAdmin\Controllers\Server\Status\QueriesController */ +#[CoversClass(QueriesController::class)] class QueriesControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/Status/StatusControllerTest.php b/test/classes/Controllers/Server/Status/StatusControllerTest.php index ce7aeec3ee..312235c445 100644 --- a/test/classes/Controllers/Server/Status/StatusControllerTest.php +++ b/test/classes/Controllers/Server/Status/StatusControllerTest.php @@ -14,8 +14,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\Status\StatusController */ +#[CoversClass(StatusController::class)] class StatusControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/Status/VariablesControllerTest.php b/test/classes/Controllers/Server/Status/VariablesControllerTest.php index 5059b66027..da201237d2 100644 --- a/test/classes/Controllers/Server/Status/VariablesControllerTest.php +++ b/test/classes/Controllers/Server/Status/VariablesControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Server\Status\VariablesController */ +#[CoversClass(VariablesController::class)] class VariablesControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Server/VariablesControllerTest.php b/test/classes/Controllers/Server/VariablesControllerTest.php index 11c9218d6a..b2c9e3a8e5 100644 --- a/test/classes/Controllers/Server/VariablesControllerTest.php +++ b/test/classes/Controllers/Server/VariablesControllerTest.php @@ -16,6 +16,7 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; use ReflectionProperty; @@ -23,7 +24,7 @@ use function __; use function htmlspecialchars; use function str_replace; -/** @covers \PhpMyAdmin\Controllers\Server\VariablesController */ +#[CoversClass(VariablesController::class)] class VariablesControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/Sql/EnumValuesControllerTest.php b/test/classes/Controllers/Sql/EnumValuesControllerTest.php index e4ae42e173..2c0d02b4a7 100644 --- a/test/classes/Controllers/Sql/EnumValuesControllerTest.php +++ b/test/classes/Controllers/Sql/EnumValuesControllerTest.php @@ -9,8 +9,9 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Sql\EnumValuesController */ +#[CoversClass(EnumValuesController::class)] class EnumValuesControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Sql/SetValuesControllerTest.php b/test/classes/Controllers/Sql/SetValuesControllerTest.php index 8f3853b478..8af3785169 100644 --- a/test/classes/Controllers/Sql/SetValuesControllerTest.php +++ b/test/classes/Controllers/Sql/SetValuesControllerTest.php @@ -9,8 +9,9 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Sql\SetValuesController */ +#[CoversClass(SetValuesController::class)] class SetValuesControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Table/AddFieldControllerTest.php b/test/classes/Controllers/Table/AddFieldControllerTest.php index bc2b3f3253..3c82147181 100644 --- a/test/classes/Controllers/Table/AddFieldControllerTest.php +++ b/test/classes/Controllers/Table/AddFieldControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\AddFieldController */ +#[CoversClass(AddFieldController::class)] class AddFieldControllerTest extends AbstractTestCase { public function testInvoke(): void diff --git a/test/classes/Controllers/Table/ChangeControllerTest.php b/test/classes/Controllers/Table/ChangeControllerTest.php index 8d74f722f7..f3c8abf8ab 100644 --- a/test/classes/Controllers/Table/ChangeControllerTest.php +++ b/test/classes/Controllers/Table/ChangeControllerTest.php @@ -14,8 +14,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\ChangeController */ +#[CoversClass(ChangeController::class)] class ChangeControllerTest extends AbstractTestCase { public function testChangeController(): void diff --git a/test/classes/Controllers/Table/ChangeRowsControllerTest.php b/test/classes/Controllers/Table/ChangeRowsControllerTest.php index 4c85a639e3..b2f7e58b85 100644 --- a/test/classes/Controllers/Table/ChangeRowsControllerTest.php +++ b/test/classes/Controllers/Table/ChangeRowsControllerTest.php @@ -10,8 +10,9 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\ChangeRowsController */ +#[CoversClass(ChangeRowsController::class)] class ChangeRowsControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/Table/ChartControllerTest.php b/test/classes/Controllers/Table/ChartControllerTest.php index 7740fb28d8..a99943ee65 100644 --- a/test/classes/Controllers/Table/ChartControllerTest.php +++ b/test/classes/Controllers/Table/ChartControllerTest.php @@ -10,6 +10,7 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\FieldHelper; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use const MYSQLI_NOT_NULL_FLAG; use const MYSQLI_NUM_FLAG; @@ -17,7 +18,7 @@ use const MYSQLI_PRI_KEY_FLAG; use const MYSQLI_TYPE_DATE; use const MYSQLI_TYPE_LONG; -/** @covers \PhpMyAdmin\Controllers\Table\ChartController */ +#[CoversClass(ChartController::class)] class ChartControllerTest extends AbstractTestCase { public function testChartController(): void diff --git a/test/classes/Controllers/Table/CreateControllerTest.php b/test/classes/Controllers/Table/CreateControllerTest.php index 7ee468807c..530f305ddc 100644 --- a/test/classes/Controllers/Table/CreateControllerTest.php +++ b/test/classes/Controllers/Table/CreateControllerTest.php @@ -12,10 +12,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; use function array_merge; -/** @covers \PhpMyAdmin\Controllers\Table\CreateController */ +#[CoversClass(CreateController::class)] class CreateControllerTest extends AbstractTestCase { public function testCreateController(): void diff --git a/test/classes/Controllers/Table/DeleteConfirmControllerTest.php b/test/classes/Controllers/Table/DeleteConfirmControllerTest.php index 196a4dc2ac..6b9b10d579 100644 --- a/test/classes/Controllers/Table/DeleteConfirmControllerTest.php +++ b/test/classes/Controllers/Table/DeleteConfirmControllerTest.php @@ -9,8 +9,9 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\DeleteConfirmController */ +#[CoversClass(DeleteConfirmController::class)] class DeleteConfirmControllerTest extends AbstractTestCase { public function testDeleteConfirmController(): void diff --git a/test/classes/Controllers/Table/DeleteRowsControllerTest.php b/test/classes/Controllers/Table/DeleteRowsControllerTest.php index d4b9f98791..f055f0606b 100644 --- a/test/classes/Controllers/Table/DeleteRowsControllerTest.php +++ b/test/classes/Controllers/Table/DeleteRowsControllerTest.php @@ -9,8 +9,9 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\DeleteRowsController */ +#[CoversClass(DeleteRowsController::class)] class DeleteRowsControllerTest extends AbstractTestCase { public function testDeleteRowsController(): void diff --git a/test/classes/Controllers/Table/DropColumnConfirmationControllerTest.php b/test/classes/Controllers/Table/DropColumnConfirmationControllerTest.php index 53cf3672bc..99add947d1 100644 --- a/test/classes/Controllers/Table/DropColumnConfirmationControllerTest.php +++ b/test/classes/Controllers/Table/DropColumnConfirmationControllerTest.php @@ -9,8 +9,9 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\DropColumnConfirmationController */ +#[CoversClass(DropColumnConfirmationController::class)] class DropColumnConfirmationControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/Table/DropColumnControllerTest.php b/test/classes/Controllers/Table/DropColumnControllerTest.php index f2423f73cd..99083eef62 100644 --- a/test/classes/Controllers/Table/DropColumnControllerTest.php +++ b/test/classes/Controllers/Table/DropColumnControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\DropColumnController */ +#[CoversClass(DropColumnController::class)] class DropColumnControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/Table/ExportControllerTest.php b/test/classes/Controllers/Table/ExportControllerTest.php index 5fcf4e6371..2b518153b7 100644 --- a/test/classes/Controllers/Table/ExportControllerTest.php +++ b/test/classes/Controllers/Table/ExportControllerTest.php @@ -15,8 +15,9 @@ use PhpMyAdmin\Plugins; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\ExportController */ +#[CoversClass(ExportController::class)] class ExportControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/Table/ExportRowsControllerTest.php b/test/classes/Controllers/Table/ExportRowsControllerTest.php index eb57fcb38a..fe3418216b 100644 --- a/test/classes/Controllers/Table/ExportRowsControllerTest.php +++ b/test/classes/Controllers/Table/ExportRowsControllerTest.php @@ -10,8 +10,9 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\ExportRowsController */ +#[CoversClass(ExportRowsController::class)] class ExportRowsControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/Table/FindReplaceControllerTest.php b/test/classes/Controllers/Table/FindReplaceControllerTest.php index c8bea9cadc..9a24b55eaa 100644 --- a/test/classes/Controllers/Table/FindReplaceControllerTest.php +++ b/test/classes/Controllers/Table/FindReplaceControllerTest.php @@ -10,8 +10,9 @@ use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Types; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\FindReplaceController */ +#[CoversClass(FindReplaceController::class)] class FindReplaceControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/Table/GetFieldControllerTest.php b/test/classes/Controllers/Table/GetFieldControllerTest.php index c076624b40..2061aaefbc 100644 --- a/test/classes/Controllers/Table/GetFieldControllerTest.php +++ b/test/classes/Controllers/Table/GetFieldControllerTest.php @@ -10,16 +10,17 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use function bin2hex; -/** @covers \PhpMyAdmin\Controllers\Table\GetFieldController */ +#[CoversClass(GetFieldController::class)] class GetFieldControllerTest extends AbstractTestCase { - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testGetFieldController(): void { $GLOBALS['db'] = 'test_db'; diff --git a/test/classes/Controllers/Table/GisVisualizationControllerTest.php b/test/classes/Controllers/Table/GisVisualizationControllerTest.php index a2a508d130..8e24874f22 100644 --- a/test/classes/Controllers/Table/GisVisualizationControllerTest.php +++ b/test/classes/Controllers/Table/GisVisualizationControllerTest.php @@ -12,11 +12,12 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\FieldHelper; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; use const MYSQLI_TYPE_GEOMETRY; use const MYSQLI_TYPE_VAR_STRING; -/** @covers \PhpMyAdmin\Controllers\Table\GisVisualizationController */ +#[CoversClass(GisVisualizationController::class)] class GisVisualizationControllerTest extends AbstractTestCase { public function testGisVisualizationController(): void diff --git a/test/classes/Controllers/Table/ImportControllerTest.php b/test/classes/Controllers/Table/ImportControllerTest.php index 34542efc3a..99340bcc81 100644 --- a/test/classes/Controllers/Table/ImportControllerTest.php +++ b/test/classes/Controllers/Table/ImportControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Plugins; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\ImportController */ +#[CoversClass(ImportController::class)] class ImportControllerTest extends AbstractTestCase { public function testImportController(): void diff --git a/test/classes/Controllers/Table/IndexRenameControllerTest.php b/test/classes/Controllers/Table/IndexRenameControllerTest.php index 0abc5e425b..b88ab743ac 100644 --- a/test/classes/Controllers/Table/IndexRenameControllerTest.php +++ b/test/classes/Controllers/Table/IndexRenameControllerTest.php @@ -11,8 +11,9 @@ use PhpMyAdmin\Table\Indexes; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\IndexRenameController */ +#[CoversClass(IndexRenameController::class)] class IndexRenameControllerTest extends AbstractTestCase { public function testIndexRenameController(): void diff --git a/test/classes/Controllers/Table/IndexesControllerTest.php b/test/classes/Controllers/Table/IndexesControllerTest.php index bfb5b17166..f053aa2a71 100644 --- a/test/classes/Controllers/Table/IndexesControllerTest.php +++ b/test/classes/Controllers/Table/IndexesControllerTest.php @@ -16,12 +16,13 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionMethod; use function __; use function sprintf; -/** @covers \PhpMyAdmin\Controllers\Table\IndexesController */ +#[CoversClass(IndexesController::class)] class IndexesControllerTest extends AbstractTestCase { /** diff --git a/test/classes/Controllers/Table/Maintenance/AnalyzeControllerTest.php b/test/classes/Controllers/Table/Maintenance/AnalyzeControllerTest.php index c364777ce0..987fd64311 100644 --- a/test/classes/Controllers/Table/Maintenance/AnalyzeControllerTest.php +++ b/test/classes/Controllers/Table/Maintenance/AnalyzeControllerTest.php @@ -10,15 +10,14 @@ use PhpMyAdmin\Table\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Maintenance\AnalyzeController */ +#[CoversClass(AnalyzeController::class)] class AnalyzeControllerTest extends AbstractTestCase { - /** - * @param string[][]|string[]|string|null $tables - * - * @dataProvider providerForTestNoTableSelected - */ + /** @param string[][]|string[]|string|null $tables */ + #[DataProvider('providerForTestNoTableSelected')] public function testNoTableSelected(array|string|null $tables): void { $request = $this->createStub(ServerRequest::class); diff --git a/test/classes/Controllers/Table/Maintenance/CheckControllerTest.php b/test/classes/Controllers/Table/Maintenance/CheckControllerTest.php index fa04d08302..327bd202b9 100644 --- a/test/classes/Controllers/Table/Maintenance/CheckControllerTest.php +++ b/test/classes/Controllers/Table/Maintenance/CheckControllerTest.php @@ -10,15 +10,14 @@ use PhpMyAdmin\Table\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Maintenance\CheckController */ +#[CoversClass(CheckController::class)] class CheckControllerTest extends AbstractTestCase { - /** - * @param string[][]|string[]|string|null $tables - * - * @dataProvider providerForTestNoTableSelected - */ + /** @param string[][]|string[]|string|null $tables */ + #[DataProvider('providerForTestNoTableSelected')] public function testNoTableSelected(array|string|null $tables): void { $request = $this->createStub(ServerRequest::class); diff --git a/test/classes/Controllers/Table/Maintenance/ChecksumControllerTest.php b/test/classes/Controllers/Table/Maintenance/ChecksumControllerTest.php index aab70771ec..41e3d6cc44 100644 --- a/test/classes/Controllers/Table/Maintenance/ChecksumControllerTest.php +++ b/test/classes/Controllers/Table/Maintenance/ChecksumControllerTest.php @@ -10,15 +10,14 @@ use PhpMyAdmin\Table\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Maintenance\ChecksumController */ +#[CoversClass(ChecksumController::class)] class ChecksumControllerTest extends AbstractTestCase { - /** - * @param string[][]|string[]|string|null $tables - * - * @dataProvider providerForTestNoTableSelected - */ + /** @param string[][]|string[]|string|null $tables */ + #[DataProvider('providerForTestNoTableSelected')] public function testNoTableSelected(array|string|null $tables): void { $request = $this->createStub(ServerRequest::class); diff --git a/test/classes/Controllers/Table/Maintenance/OptimizeControllerTest.php b/test/classes/Controllers/Table/Maintenance/OptimizeControllerTest.php index a7a65c4309..a9f1bc4e6c 100644 --- a/test/classes/Controllers/Table/Maintenance/OptimizeControllerTest.php +++ b/test/classes/Controllers/Table/Maintenance/OptimizeControllerTest.php @@ -10,15 +10,14 @@ use PhpMyAdmin\Table\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Maintenance\OptimizeController */ +#[CoversClass(OptimizeController::class)] class OptimizeControllerTest extends AbstractTestCase { - /** - * @param string[][]|string[]|string|null $tables - * - * @dataProvider providerForTestNoTableSelected - */ + /** @param string[][]|string[]|string|null $tables */ + #[DataProvider('providerForTestNoTableSelected')] public function testNoTableSelected(array|string|null $tables): void { $request = $this->createStub(ServerRequest::class); diff --git a/test/classes/Controllers/Table/Maintenance/RepairControllerTest.php b/test/classes/Controllers/Table/Maintenance/RepairControllerTest.php index 3d2f9834ea..1fe2933594 100644 --- a/test/classes/Controllers/Table/Maintenance/RepairControllerTest.php +++ b/test/classes/Controllers/Table/Maintenance/RepairControllerTest.php @@ -10,15 +10,14 @@ use PhpMyAdmin\Table\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Maintenance\RepairController */ +#[CoversClass(RepairController::class)] class RepairControllerTest extends AbstractTestCase { - /** - * @param string[][]|string[]|string|null $tables - * - * @dataProvider providerForTestNoTableSelected - */ + /** @param string[][]|string[]|string|null $tables */ + #[DataProvider('providerForTestNoTableSelected')] public function testNoTableSelected(array|string|null $tables): void { $request = $this->createStub(ServerRequest::class); diff --git a/test/classes/Controllers/Table/OperationsControllerTest.php b/test/classes/Controllers/Table/OperationsControllerTest.php index d1c83bc0fe..2cab611a81 100644 --- a/test/classes/Controllers/Table/OperationsControllerTest.php +++ b/test/classes/Controllers/Table/OperationsControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\StorageEngine; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\OperationsController */ +#[CoversClass(OperationsController::class)] class OperationsControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Table/Partition/AnalyzeControllerTest.php b/test/classes/Controllers/Table/Partition/AnalyzeControllerTest.php index c8bca73b27..6fffdad5f6 100644 --- a/test/classes/Controllers/Table/Partition/AnalyzeControllerTest.php +++ b/test/classes/Controllers/Table/Partition/AnalyzeControllerTest.php @@ -11,11 +11,13 @@ use PhpMyAdmin\Partitioning\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Partition\AnalyzeController */ +#[CoversClass(AnalyzeController::class)] class AnalyzeControllerTest extends AbstractTestCase { - /** @dataProvider providerForTestInvalidDatabaseAndTable */ + #[DataProvider('providerForTestInvalidDatabaseAndTable')] public function testInvalidDatabaseAndTable( string|null $partition, string|null $db, diff --git a/test/classes/Controllers/Table/Partition/CheckControllerTest.php b/test/classes/Controllers/Table/Partition/CheckControllerTest.php index 014816d456..8da9bdd41f 100644 --- a/test/classes/Controllers/Table/Partition/CheckControllerTest.php +++ b/test/classes/Controllers/Table/Partition/CheckControllerTest.php @@ -11,11 +11,13 @@ use PhpMyAdmin\Partitioning\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Partition\CheckController */ +#[CoversClass(CheckController::class)] class CheckControllerTest extends AbstractTestCase { - /** @dataProvider providerForTestInvalidDatabaseAndTable */ + #[DataProvider('providerForTestInvalidDatabaseAndTable')] public function testInvalidDatabaseAndTable( string|null $partition, string|null $db, diff --git a/test/classes/Controllers/Table/Partition/DropControllerTest.php b/test/classes/Controllers/Table/Partition/DropControllerTest.php index 58d15485bc..35640742d0 100644 --- a/test/classes/Controllers/Table/Partition/DropControllerTest.php +++ b/test/classes/Controllers/Table/Partition/DropControllerTest.php @@ -11,11 +11,13 @@ use PhpMyAdmin\Partitioning\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Partition\DropController */ +#[CoversClass(DropController::class)] class DropControllerTest extends AbstractTestCase { - /** @dataProvider providerForTestInvalidDatabaseAndTable */ + #[DataProvider('providerForTestInvalidDatabaseAndTable')] public function testInvalidDatabaseAndTable( string|null $partition, string|null $db, diff --git a/test/classes/Controllers/Table/Partition/OptimizeControllerTest.php b/test/classes/Controllers/Table/Partition/OptimizeControllerTest.php index 57eba01a3d..dba2cb83f6 100644 --- a/test/classes/Controllers/Table/Partition/OptimizeControllerTest.php +++ b/test/classes/Controllers/Table/Partition/OptimizeControllerTest.php @@ -11,11 +11,13 @@ use PhpMyAdmin\Partitioning\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Partition\OptimizeController */ +#[CoversClass(OptimizeController::class)] class OptimizeControllerTest extends AbstractTestCase { - /** @dataProvider providerForTestInvalidDatabaseAndTable */ + #[DataProvider('providerForTestInvalidDatabaseAndTable')] public function testInvalidDatabaseAndTable( string|null $partition, string|null $db, diff --git a/test/classes/Controllers/Table/Partition/RebuildControllerTest.php b/test/classes/Controllers/Table/Partition/RebuildControllerTest.php index f6092610ae..2d4ae9c65b 100644 --- a/test/classes/Controllers/Table/Partition/RebuildControllerTest.php +++ b/test/classes/Controllers/Table/Partition/RebuildControllerTest.php @@ -11,11 +11,13 @@ use PhpMyAdmin\Partitioning\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Partition\RebuildController */ +#[CoversClass(RebuildController::class)] class RebuildControllerTest extends AbstractTestCase { - /** @dataProvider providerForTestInvalidDatabaseAndTable */ + #[DataProvider('providerForTestInvalidDatabaseAndTable')] public function testInvalidDatabaseAndTable( string|null $partition, string|null $db, diff --git a/test/classes/Controllers/Table/Partition/RepairControllerTest.php b/test/classes/Controllers/Table/Partition/RepairControllerTest.php index dab31e4809..e22032052a 100644 --- a/test/classes/Controllers/Table/Partition/RepairControllerTest.php +++ b/test/classes/Controllers/Table/Partition/RepairControllerTest.php @@ -11,11 +11,13 @@ use PhpMyAdmin\Partitioning\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Partition\RepairController */ +#[CoversClass(RepairController::class)] class RepairControllerTest extends AbstractTestCase { - /** @dataProvider providerForTestInvalidDatabaseAndTable */ + #[DataProvider('providerForTestInvalidDatabaseAndTable')] public function testInvalidDatabaseAndTable( string|null $partition, string|null $db, diff --git a/test/classes/Controllers/Table/Partition/TruncateControllerTest.php b/test/classes/Controllers/Table/Partition/TruncateControllerTest.php index 253dd784cc..7393835302 100644 --- a/test/classes/Controllers/Table/Partition/TruncateControllerTest.php +++ b/test/classes/Controllers/Table/Partition/TruncateControllerTest.php @@ -11,11 +11,13 @@ use PhpMyAdmin\Partitioning\Maintenance; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Controllers\Table\Partition\TruncateController */ +#[CoversClass(TruncateController::class)] class TruncateControllerTest extends AbstractTestCase { - /** @dataProvider providerForTestInvalidDatabaseAndTable */ + #[DataProvider('providerForTestInvalidDatabaseAndTable')] public function testInvalidDatabaseAndTable( string|null $partition, string|null $db, diff --git a/test/classes/Controllers/Table/PrivilegesControllerTest.php b/test/classes/Controllers/Table/PrivilegesControllerTest.php index 3006137e5c..3ffff5cda5 100644 --- a/test/classes/Controllers/Table/PrivilegesControllerTest.php +++ b/test/classes/Controllers/Table/PrivilegesControllerTest.php @@ -11,10 +11,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; use function __; -/** @covers \PhpMyAdmin\Controllers\Table\PrivilegesController */ +#[CoversClass(PrivilegesController::class)] class PrivilegesControllerTest extends AbstractTestCase { /** diff --git a/test/classes/Controllers/Table/RecentFavoriteControllerTest.php b/test/classes/Controllers/Table/RecentFavoriteControllerTest.php index bb507c42a7..d25debec64 100644 --- a/test/classes/Controllers/Table/RecentFavoriteControllerTest.php +++ b/test/classes/Controllers/Table/RecentFavoriteControllerTest.php @@ -14,14 +14,15 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use ReflectionClass; use Symfony\Component\DependencyInjection\ContainerBuilder; -/** - * @covers \PhpMyAdmin\Controllers\Table\RecentFavoriteController - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ +#[CoversClass(RecentFavoriteController::class)] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] class RecentFavoriteControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Table/RelationControllerTest.php b/test/classes/Controllers/Table/RelationControllerTest.php index 1271961e91..ca29c41912 100644 --- a/test/classes/Controllers/Table/RelationControllerTest.php +++ b/test/classes/Controllers/Table/RelationControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\RelationController */ +#[CoversClass(RelationController::class)] class RelationControllerTest extends AbstractTestCase { private ResponseStub $response; diff --git a/test/classes/Controllers/Table/ReplaceControllerTest.php b/test/classes/Controllers/Table/ReplaceControllerTest.php index 17dc5a51c5..7ac12e7dbc 100644 --- a/test/classes/Controllers/Table/ReplaceControllerTest.php +++ b/test/classes/Controllers/Table/ReplaceControllerTest.php @@ -22,10 +22,11 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; use Symfony\Component\DependencyInjection\ContainerBuilder; -/** @covers \PhpMyAdmin\Controllers\Table\ReplaceController */ +#[CoversClass(ReplaceController::class)] class ReplaceControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Table/SearchControllerTest.php b/test/classes/Controllers/Table/SearchControllerTest.php index 2418d3b816..65c554e8c5 100644 --- a/test/classes/Controllers/Table/SearchControllerTest.php +++ b/test/classes/Controllers/Table/SearchControllerTest.php @@ -15,12 +15,13 @@ use PhpMyAdmin\Tests\FieldHelper; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub; use PhpMyAdmin\Types; +use PHPUnit\Framework\Attributes\CoversClass; use function hash; use const MYSQLI_TYPE_LONG; -/** @covers \PhpMyAdmin\Controllers\Table\SearchController */ +#[CoversClass(SearchController::class)] class SearchControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Table/SqlControllerTest.php b/test/classes/Controllers/Table/SqlControllerTest.php index 86dd995e44..26cbc9c7c6 100644 --- a/test/classes/Controllers/Table/SqlControllerTest.php +++ b/test/classes/Controllers/Table/SqlControllerTest.php @@ -14,11 +14,10 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** - * @covers \PhpMyAdmin\Controllers\Table\SqlController - * @covers \PhpMyAdmin\SqlQueryForm - */ +#[CoversClass(SqlController::class)] +#[CoversClass(SqlQueryForm::class)] class SqlControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Table/Structure/ChangeControllerTest.php b/test/classes/Controllers/Table/Structure/ChangeControllerTest.php index 2ab63a323d..0c28229ee5 100644 --- a/test/classes/Controllers/Table/Structure/ChangeControllerTest.php +++ b/test/classes/Controllers/Table/Structure/ChangeControllerTest.php @@ -13,9 +13,10 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; -/** @covers \PhpMyAdmin\Controllers\Table\Structure\ChangeController */ +#[CoversClass(ChangeController::class)] class ChangeControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Table/Structure/SaveControllerTest.php b/test/classes/Controllers/Table/Structure/SaveControllerTest.php index 6a9f36e917..18ae8ff1e3 100644 --- a/test/classes/Controllers/Table/Structure/SaveControllerTest.php +++ b/test/classes/Controllers/Table/Structure/SaveControllerTest.php @@ -12,9 +12,10 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; -/** @covers \PhpMyAdmin\Controllers\Table\Structure\SaveController */ +#[CoversClass(SaveController::class)] class SaveControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Controllers/Table/Structure/SpatialControllerTest.php b/test/classes/Controllers/Table/Structure/SpatialControllerTest.php index d45404ccf5..681d7025fa 100644 --- a/test/classes/Controllers/Table/Structure/SpatialControllerTest.php +++ b/test/classes/Controllers/Table/Structure/SpatialControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Table\Indexes; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\Structure\SpatialController */ +#[CoversClass(SpatialController::class)] class SpatialControllerTest extends AbstractTestCase { public function testAddSpatialKeyToSingleField(): void diff --git a/test/classes/Controllers/Table/Structure/UniqueControllerTest.php b/test/classes/Controllers/Table/Structure/UniqueControllerTest.php index 5f1ab8f5ac..c2560cbd17 100644 --- a/test/classes/Controllers/Table/Structure/UniqueControllerTest.php +++ b/test/classes/Controllers/Table/Structure/UniqueControllerTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Table\Indexes; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\Structure\UniqueController */ +#[CoversClass(UniqueController::class)] class UniqueControllerTest extends AbstractTestCase { public function testAddUniqueKeyToSingleField(): void diff --git a/test/classes/Controllers/Table/StructureControllerTest.php b/test/classes/Controllers/Table/StructureControllerTest.php index f8f03b8dd8..30c1d49d66 100644 --- a/test/classes/Controllers/Table/StructureControllerTest.php +++ b/test/classes/Controllers/Table/StructureControllerTest.php @@ -16,9 +16,10 @@ use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; use PhpMyAdmin\Util; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; -/** @covers \PhpMyAdmin\Controllers\Table\StructureController */ +#[CoversClass(StructureController::class)] class StructureControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Table/TrackingControllerTest.php b/test/classes/Controllers/Table/TrackingControllerTest.php index 595625e010..90ababa125 100644 --- a/test/classes/Controllers/Table/TrackingControllerTest.php +++ b/test/classes/Controllers/Table/TrackingControllerTest.php @@ -15,8 +15,9 @@ use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Tracking\Tracking; use PhpMyAdmin\Tracking\TrackingChecker; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\TrackingController */ +#[CoversClass(TrackingController::class)] class TrackingControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/Table/ZoomSearchControllerTest.php b/test/classes/Controllers/Table/ZoomSearchControllerTest.php index d40199becc..82baf22c01 100644 --- a/test/classes/Controllers/Table/ZoomSearchControllerTest.php +++ b/test/classes/Controllers/Table/ZoomSearchControllerTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Controllers\Table\ZoomSearchController */ +#[CoversClass(ZoomSearchController::class)] class ZoomSearchControllerTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Controllers/ThemeSetControllerTest.php b/test/classes/Controllers/ThemeSetControllerTest.php index 6a886a721b..ddab1e350d 100644 --- a/test/classes/Controllers/ThemeSetControllerTest.php +++ b/test/classes/Controllers/ThemeSetControllerTest.php @@ -11,8 +11,12 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Theme\ThemeManager; use PhpMyAdmin\UserPreferences; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; -/** @covers \PhpMyAdmin\Controllers\ThemeSetController */ +#[CoversClass(ThemeSetController::class)] class ThemeSetControllerTest extends AbstractTestCase { protected function setUp(): void @@ -22,10 +26,8 @@ class ThemeSetControllerTest extends AbstractTestCase $GLOBALS['dbi'] = $this->createDatabaseInterface(); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testSetTheme(): void { $GLOBALS['cfg']['ThemeManager'] = true; @@ -46,13 +48,10 @@ class ThemeSetControllerTest extends AbstractTestCase (new ThemeSetController(new ResponseRenderer(), new Template(), $themeManager, $userPreferences))($request); } - /** - * @param string[]|string|null $themeName - * - * @runInSeparateProcess - * @preserveGlobalState disabled - * @dataProvider providerForTestWithoutTheme - */ + /** @param string[]|string|null $themeName */ + #[DataProvider('providerForTestWithoutTheme')] + #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testWithoutTheme(bool $hasThemes, array|string|null $themeName): void { $GLOBALS['cfg']['ThemeManager'] = $hasThemes; diff --git a/test/classes/Controllers/Transformation/OverviewControllerTest.php b/test/classes/Controllers/Transformation/OverviewControllerTest.php index 7a65843d46..adeec07d68 100644 --- a/test/classes/Controllers/Transformation/OverviewControllerTest.php +++ b/test/classes/Controllers/Transformation/OverviewControllerTest.php @@ -10,10 +10,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; use function __; -/** @covers \PhpMyAdmin\Controllers\Transformation\OverviewController */ +#[CoversClass(OverviewController::class)] class OverviewControllerTest extends AbstractTestCase { /** diff --git a/test/classes/Controllers/Triggers/IndexControllerTest.php b/test/classes/Controllers/Triggers/IndexControllerTest.php index 7f34760fed..88e0ee2758 100644 --- a/test/classes/Controllers/Triggers/IndexControllerTest.php +++ b/test/classes/Controllers/Triggers/IndexControllerTest.php @@ -10,11 +10,10 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\Triggers\Triggers; +use PHPUnit\Framework\Attributes\CoversClass; -/** - * @covers \PhpMyAdmin\Controllers\Triggers\IndexController - * @covers \PhpMyAdmin\Triggers\Triggers - */ +#[CoversClass(IndexController::class)] +#[CoversClass(Triggers::class)] final class IndexControllerTest extends AbstractTestCase { public function testWithTriggers(): void diff --git a/test/classes/Controllers/VersionCheckControllerTest.php b/test/classes/Controllers/VersionCheckControllerTest.php index ed7941a7af..1d3e8f9bef 100644 --- a/test/classes/Controllers/VersionCheckControllerTest.php +++ b/test/classes/Controllers/VersionCheckControllerTest.php @@ -10,11 +10,11 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; use PhpMyAdmin\VersionInformation; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; -/** - * @covers \PhpMyAdmin\Controllers\VersionCheckController - * @runTestsInSeparateProcesses - */ +#[CoversClass(VersionCheckController::class)] +#[RunTestsInSeparateProcesses] class VersionCheckControllerTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/CoreTest.php b/test/classes/CoreTest.php index 908fe4b437..9073b9792f 100644 --- a/test/classes/CoreTest.php +++ b/test/classes/CoreTest.php @@ -8,6 +8,12 @@ use PhpMyAdmin\Core; use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use stdClass; use function __; @@ -21,7 +27,7 @@ use function strtr; use const ENT_QUOTES; -/** @covers \PhpMyAdmin\Core */ +#[CoversClass(Core::class)] class CoreTest extends AbstractNetworkTestCase { /** @@ -239,9 +245,8 @@ class CoreTest extends AbstractNetworkTestCase * @param string[] $allowList Allow list * @param bool $include whether the page is going to be included * @param bool $expected Expected value - * - * @dataProvider providerTestGotoNowhere */ + #[DataProvider('providerTestGotoNowhere')] public function testGotoNowhere(string $page, array $allowList, bool $include, bool $expected): void { $this->assertSame($expected, Core::checkPageValidity($page, $allowList, $include)); @@ -271,11 +276,9 @@ class CoreTest extends AbstractNetworkTestCase * * @param string $size Size * @param int $expected Expected value - * - * @group 32bit-incompatible - * - * @dataProvider providerTestGetRealSize */ + #[DataProvider('providerTestGetRealSize')] + #[Group('32bit-incompatible')] public function testGetRealSize(string $size, int $expected): void { $this->assertEquals($expected, Core::getRealSize($size)); @@ -322,9 +325,8 @@ class CoreTest extends AbstractNetworkTestCase * * @param string $link URL where to go * @param string $url Expected value - * - * @dataProvider providerTestLinkURL */ + #[DataProvider('providerTestLinkURL')] public function testLinkURL(string $link, string $url): void { $this->assertEquals(Core::linkURL($link), $url); @@ -429,7 +431,7 @@ class CoreTest extends AbstractNetworkTestCase Core::sendHeaderLocation($testUri); } - /** @dataProvider provideTestIsAllowedDomain */ + #[DataProvider('provideTestIsAllowedDomain')] public function testIsAllowedDomain(string $url, bool $expected): void { $_SERVER['SERVER_NAME'] = 'server.local'; @@ -478,9 +480,8 @@ class CoreTest extends AbstractNetworkTestCase * * @param string $data Serialized data * @param mixed $expected Expected result - * - * @dataProvider provideTestSafeUnserialize */ + #[DataProvider('provideTestSafeUnserialize')] public function testSafeUnserialize(string $data, mixed $expected): void { $this->assertEquals( @@ -519,9 +520,8 @@ class CoreTest extends AbstractNetworkTestCase * * @param string $host Test host name * @param string $expected Expected result - * - * @dataProvider provideTestSanitizeMySQLHost */ + #[DataProvider('provideTestSanitizeMySQLHost')] public function testSanitizeMySQLHost(string $host, string $expected): void { $this->assertEquals( @@ -720,9 +720,8 @@ class CoreTest extends AbstractNetworkTestCase /** * @param string[] $encrypted * @param string[] $decrypted - * - * @dataProvider providerForTestPopulateRequestWithEncryptedQueryParamsWithInvalidParam */ + #[DataProvider('providerForTestPopulateRequestWithEncryptedQueryParamsWithInvalidParam')] public function testPopulateRequestWithEncryptedQueryParamsWithInvalidParam( array $encrypted, array $decrypted, @@ -752,12 +751,10 @@ class CoreTest extends AbstractNetworkTestCase return [[[], []], [['eq' => []], []], [['eq' => ''], []], [['eq' => 'invalid'], []]]; } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @requires extension xdebug - * @group ext-xdebug - */ + #[PreserveGlobalState(false)] + #[Group('ext-xdebug')] + #[RequiresPhpExtension('xdebug')] + #[RunInSeparateProcess] public function testDownloadHeader(): void { $GLOBALS['config']->set('PMA_USR_BROWSER_AGENT', 'FIREFOX'); @@ -779,12 +776,10 @@ class CoreTest extends AbstractNetworkTestCase $this->assertNotContains('Content-Encoding: gzip', $headersList); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @requires extension xdebug - * @group ext-xdebug - */ + #[PreserveGlobalState(false)] + #[Group('ext-xdebug')] + #[RequiresPhpExtension('xdebug')] + #[RunInSeparateProcess] public function testDownloadHeader2(): void { $GLOBALS['config']->set('PMA_USR_BROWSER_AGENT', 'FIREFOX'); diff --git a/test/classes/CreateAddFieldTest.php b/test/classes/CreateAddFieldTest.php index a39a887c84..8da71f4d5e 100644 --- a/test/classes/CreateAddFieldTest.php +++ b/test/classes/CreateAddFieldTest.php @@ -5,10 +5,12 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\CreateAddField; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function json_encode; -/** @covers \PhpMyAdmin\CreateAddField */ +#[CoversClass(CreateAddField::class)] class CreateAddFieldTest extends AbstractTestCase { private CreateAddField $createAddField; @@ -29,9 +31,8 @@ class CreateAddFieldTest extends AbstractTestCase * * @param string $expected Expected result * @param array $request $_REQUEST array - * - * @dataProvider providerGetPartitionsDefinition */ + #[DataProvider('providerGetPartitionsDefinition')] public function testGetPartitionsDefinition(string $expected, array $request): void { $_POST = $request; @@ -223,9 +224,8 @@ class CreateAddFieldTest extends AbstractTestCase * @param string $db Database name * @param string $table Table name * @param array $request $_REQUEST array - * - * @dataProvider providerGetTableCreationQuery */ + #[DataProvider('providerGetTableCreationQuery')] public function testGetTableCreationQuery(string $expected, string $db, string $table, array $request): void { $_POST = $request; @@ -296,9 +296,8 @@ class CreateAddFieldTest extends AbstractTestCase * * @param int $expected Expected result * @param mixed[] $request $_REQUEST array - * - * @dataProvider providerGetNumberOfFieldsFromRequest */ + #[DataProvider('providerGetNumberOfFieldsFromRequest')] public function testGetNumberOfFieldsFromRequest(int $expected, array $request): void { $_POST = $request; @@ -481,11 +480,8 @@ class CreateAddFieldTest extends AbstractTestCase ]; } - /** - * @param array $request - * - * @dataProvider providerGetColumnCreationQueryRequest - */ + /** @param array $request */ + #[DataProvider('providerGetColumnCreationQueryRequest')] public function testGetColumnCreationQuery(string $expected, array $request): void { $_POST = $request; diff --git a/test/classes/Crypto/CryptoTest.php b/test/classes/Crypto/CryptoTest.php index fc016fce03..b68bb49b6b 100644 --- a/test/classes/Crypto/CryptoTest.php +++ b/test/classes/Crypto/CryptoTest.php @@ -6,11 +6,12 @@ namespace PhpMyAdmin\Tests\Crypto; use PhpMyAdmin\Crypto\Crypto; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use function mb_strlen; use function str_repeat; -/** @covers \PhpMyAdmin\Crypto\Crypto */ +#[CoversClass(Crypto::class)] class CryptoTest extends AbstractTestCase { public function testWithValidKeyFromConfig(): void diff --git a/test/classes/Database/CentralColumnsTest.php b/test/classes/Database/CentralColumnsTest.php index ce2acf9fe8..7a7778fbfc 100644 --- a/test/classes/Database/CentralColumnsTest.php +++ b/test/classes/Database/CentralColumnsTest.php @@ -12,15 +12,16 @@ use PhpMyAdmin\Dbal\Connection; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Types; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use ReflectionClass; use function array_slice; -/** - * @covers \PhpMyAdmin\Database\CentralColumns - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ +#[CoversClass(CentralColumns::class)] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] class CentralColumnsTest extends AbstractTestCase { private CentralColumns $centralColumns; diff --git a/test/classes/Database/Designer/CommonTest.php b/test/classes/Database/Designer/CommonTest.php index 40250d859c..d81226ef77 100644 --- a/test/classes/Database/Designer/CommonTest.php +++ b/test/classes/Database/Designer/CommonTest.php @@ -13,11 +13,12 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Version; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; use function sprintf; -/** @covers \PhpMyAdmin\Database\Designer\Common */ +#[CoversClass(Common::class)] class CommonTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Database/DesignerTest.php b/test/classes/Database/DesignerTest.php index ac54e42e23..971abe52f8 100644 --- a/test/classes/Database/DesignerTest.php +++ b/test/classes/Database/DesignerTest.php @@ -11,9 +11,10 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Version; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionMethod; -/** @covers \PhpMyAdmin\Database\Designer */ +#[CoversClass(Designer::class)] class DesignerTest extends AbstractTestCase { private Designer $designer; diff --git a/test/classes/Database/EventsTest.php b/test/classes/Database/EventsTest.php index afdce82ea7..6f35f5f21b 100644 --- a/test/classes/Database/EventsTest.php +++ b/test/classes/Database/EventsTest.php @@ -9,8 +9,10 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Database\Events */ +#[CoversClass(Events::class)] class EventsTest extends AbstractTestCase { private Events $events; @@ -47,9 +49,8 @@ class EventsTest extends AbstractTestCase * * @param array $in Input * @param array $out Expected output - * - * @dataProvider providerGetDataFromRequest */ + #[DataProvider('providerGetDataFromRequest')] public function testGetDataFromRequestEmpty(array $in, array $out): void { unset($_POST); @@ -146,9 +147,8 @@ class EventsTest extends AbstractTestCase * * @param array $data Data for routine * @param string $matcher Matcher - * - * @dataProvider providerGetEditorFormAdd */ + #[DataProvider('providerGetEditorFormAdd')] public function testGetEditorFormAdd(array $data, string $matcher): void { ResponseRenderer::getInstance()->setAjax(false); @@ -201,9 +201,8 @@ class EventsTest extends AbstractTestCase * * @param array $data Data for routine * @param string $matcher Matcher - * - * @dataProvider providerGetEditorFormEdit */ + #[DataProvider('providerGetEditorFormEdit')] public function testGetEditorFormEdit(array $data, string $matcher): void { ResponseRenderer::getInstance()->setAjax(false); @@ -256,9 +255,8 @@ class EventsTest extends AbstractTestCase * * @param array $data Data for routine * @param string $matcher Matcher - * - * @dataProvider providerGetEditorFormAjax */ + #[DataProvider('providerGetEditorFormAjax')] public function testGetEditorFormAjax(array $data, string $matcher): void { ResponseRenderer::getInstance()->setAjax(true); @@ -306,9 +304,8 @@ class EventsTest extends AbstractTestCase * @param array $request Request * @param string $query Query * @param int $numErr Error number - * - * @dataProvider providerGetQueryFromRequest */ + #[DataProvider('providerGetQueryFromRequest')] public function testGetQueryFromRequest(array $request, string $query, int $numErr): void { $GLOBALS['errors'] = []; diff --git a/test/classes/Database/RoutinesTest.php b/test/classes/Database/RoutinesTest.php index 80664599a9..aba661ad44 100644 --- a/test/classes/Database/RoutinesTest.php +++ b/test/classes/Database/RoutinesTest.php @@ -11,8 +11,11 @@ use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Types; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Depends; -/** @covers \PhpMyAdmin\Database\Routines */ +#[CoversClass(Routines::class)] class RoutinesTest extends AbstractTestCase { private Routines $routines; @@ -53,9 +56,8 @@ class RoutinesTest extends AbstractTestCase * * @param array $in Input * @param array $out Expected output - * - * @dataProvider providerGetDataFromRequest */ + #[DataProvider('providerGetDataFromRequest')] public function testGetDataFromRequest(array $in, array $out): void { unset($_POST); @@ -245,10 +247,9 @@ class RoutinesTest extends AbstractTestCase * Test for getParameterRow * * @param array $data Data for routine - * - * @depends testGetParameterRowEmpty - * @dataProvider providerGetParameterRow */ + #[Depends('testGetParameterRowEmpty')] + #[DataProvider('providerGetParameterRow')] public function testGetParameterRow(array $data, int $index, string $matcher): void { $this->assertStringContainsString( @@ -303,10 +304,9 @@ class RoutinesTest extends AbstractTestCase * Test for getParameterRow * * @param array $data Data for routine - * - * @depends testGetParameterRow - * @dataProvider providerGetParameterRowAjax */ + #[Depends('testGetParameterRow')] + #[DataProvider('providerGetParameterRowAjax')] public function testGetParameterRowAjax(array $data, string $matcher): void { ResponseRenderer::getInstance()->setAjax(true); @@ -363,10 +363,9 @@ class RoutinesTest extends AbstractTestCase * Test for getEditorForm * * @param array $data Data for routine - * - * @depends testGetParameterRowAjax - * @dataProvider providerGetEditorForm1 */ + #[Depends('testGetParameterRowAjax')] + #[DataProvider('providerGetEditorForm1')] public function testGetEditorForm1(array $data, string $matcher): void { $this->assertStringContainsString( @@ -432,10 +431,9 @@ class RoutinesTest extends AbstractTestCase * Test for getEditorForm * * @param array $data Data for routine - * - * @depends testGetParameterRowAjax - * @dataProvider providerGetEditorForm2 */ + #[Depends('testGetParameterRowAjax')] + #[DataProvider('providerGetEditorForm2')] public function testGetEditorForm2(array $data, string $matcher): void { $this->assertStringContainsString( @@ -501,10 +499,9 @@ class RoutinesTest extends AbstractTestCase * Test for getEditorForm * * @param array $data Data for routine - * - * @depends testGetParameterRowAjax - * @dataProvider providerGetEditorForm3 */ + #[Depends('testGetParameterRowAjax')] + #[DataProvider('providerGetEditorForm3')] public function testGetEditorForm3(array $data, string $matcher): void { ResponseRenderer::getInstance()->setAjax(true); @@ -571,10 +568,9 @@ class RoutinesTest extends AbstractTestCase * Test for getEditorForm * * @param array $data Data for routine - * - * @depends testGetParameterRowAjax - * @dataProvider providerGetEditorForm4 */ + #[Depends('testGetParameterRowAjax')] + #[DataProvider('providerGetEditorForm4')] public function testGetEditorForm4(array $data, string $matcher): void { $this->assertStringContainsString( @@ -623,9 +619,8 @@ class RoutinesTest extends AbstractTestCase * Test for getExecuteForm * * @param array $data Data for routine - * - * @dataProvider providerGetExecuteForm1 */ + #[DataProvider('providerGetExecuteForm1')] public function testGetExecuteForm1(array $data, string $matcher): void { $GLOBALS['cfg']['ShowFunctionFields'] = true; @@ -701,9 +696,8 @@ class RoutinesTest extends AbstractTestCase * Test for getExecuteForm * * @param array> $data Data for routine - * - * @dataProvider providerGetExecuteForm2 */ + #[DataProvider('providerGetExecuteForm2')] public function testGetExecuteForm2(array $data, string $matcher): void { ResponseRenderer::getInstance()->setAjax(true); @@ -775,9 +769,8 @@ class RoutinesTest extends AbstractTestCase * @param array> $request Request * @param string $query Query * @param int $numErr Error number - * - * @dataProvider providerGetQueryFromRequest */ + #[DataProvider('providerGetQueryFromRequest')] public function testGetQueryFromRequest(array $request, string $query, int $numErr): void { $GLOBALS['cfg']['ShowFunctionFields'] = false; diff --git a/test/classes/Database/SearchTest.php b/test/classes/Database/SearchTest.php index f71d467be6..c3ba563089 100644 --- a/test/classes/Database/SearchTest.php +++ b/test/classes/Database/SearchTest.php @@ -8,8 +8,10 @@ use PhpMyAdmin\Database\Search; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Database\Search */ +#[CoversClass(Search::class)] class SearchTest extends AbstractTestCase { protected Search $object; @@ -60,9 +62,8 @@ class SearchTest extends AbstractTestCase * * @param string $type type * @param string $expected expected result - * - * @dataProvider searchTypes */ + #[DataProvider('searchTypes')] public function testGetWhereClause(string $type, string $expected): void { $_POST['criteriaSearchType'] = $type; diff --git a/test/classes/DatabaseInterfaceTest.php b/test/classes/DatabaseInterfaceTest.php index 8e8f6d989c..c8c9b8fad6 100644 --- a/test/classes/DatabaseInterfaceTest.php +++ b/test/classes/DatabaseInterfaceTest.php @@ -16,8 +16,10 @@ use PhpMyAdmin\Query\Utilities; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SystemDatabase; use PhpMyAdmin\Utils\SessionCache; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\DatabaseInterface */ +#[CoversClass(DatabaseInterface::class)] class DatabaseInterfaceTest extends AbstractTestCase { protected function setUp(): void @@ -47,9 +49,8 @@ class DatabaseInterfaceTest extends AbstractTestCase * @param mixed[] $expected expected result * @param bool $needsSecondCall The test will need to call another time the DB * @psalm-param list>|false $value - * - * @dataProvider currentUserData */ + #[DataProvider('currentUserData')] public function testGetCurrentUser(array|false $value, string $string, array $expected, bool $needsSecondCall): void { $dummyDbi = $this->createDbiDummy(); @@ -170,9 +171,8 @@ class DatabaseInterfaceTest extends AbstractTestCase * @param bool $isMariaDb True if mariadb * @param bool $isPercona True if percona * @phpstan-param array $version - * - * @dataProvider provideDatabaseVersionData */ + #[DataProvider('provideDatabaseVersionData')] public function testPostConnectShouldSetVersion( array $version, int $versionInt, @@ -238,9 +238,8 @@ class DatabaseInterfaceTest extends AbstractTestCase * @param int $errorNumber Error code * @param string $errorMessage Error message as returned by server * @param string $match Expected text - * - * @dataProvider errorData */ + #[DataProvider('errorData')] public function testFormatError(int $errorNumber, string $errorMessage, string $match): void { $this->assertStringContainsString( @@ -268,9 +267,8 @@ class DatabaseInterfaceTest extends AbstractTestCase * @param string[][] $value value * @param bool $expected expected result * @psalm-param list> $value - * - * @dataProvider isAmazonRdsData */ + #[DataProvider('isAmazonRdsData')] public function testIsAmazonRdsData(array $value, bool $expected): void { $dummyDbi = $this->createDbiDummy(); @@ -310,9 +308,8 @@ class DatabaseInterfaceTest extends AbstractTestCase * @param int $expected expected numeric version * @param int $major expected major version * @param bool $upgrade whether upgrade should ne needed - * - * @dataProvider versionData */ + #[DataProvider('versionData')] public function testVersion(string $version, int $expected, int $major, bool $upgrade): void { $verInt = Utilities::versionToInt($version); @@ -702,9 +699,8 @@ class DatabaseInterfaceTest extends AbstractTestCase * @param bool $isMariaDb True if mariadb * @param bool $isPercona True if percona * @phpstan-param array $version - * - * @dataProvider provideDatabaseVersionData */ + #[DataProvider('provideDatabaseVersionData')] public function testSetVersion( array $version, int $versionInt, @@ -754,7 +750,7 @@ class DatabaseInterfaceTest extends AbstractTestCase ]; } - /** @dataProvider providerForTestGetLowerCaseNames */ + #[DataProvider('providerForTestGetLowerCaseNames')] public function testGetLowerCaseNames(string|false|null $result, int $expected): void { $dbiDummy = $this->createDbiDummy(); diff --git a/test/classes/Dbal/DbiDummyTest.php b/test/classes/Dbal/DbiDummyTest.php index 075c9a1dc2..a738b78d21 100644 --- a/test/classes/Dbal/DbiDummyTest.php +++ b/test/classes/Dbal/DbiDummyTest.php @@ -9,8 +9,10 @@ use PhpMyAdmin\Query\Utilities; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\DummyResult; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\DataProvider; -/** @coversNothing */ +#[CoversNothing] class DbiDummyTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -66,9 +68,8 @@ class DbiDummyTest extends AbstractTestCase * * @param string $schema schema name * @param bool $expected expected result - * - * @dataProvider schemaData */ + #[DataProvider('schemaData')] public function testSystemSchema(string $schema, bool $expected): void { $this->assertEquals($expected, Utilities::isSystemSchema($schema)); @@ -86,9 +87,8 @@ class DbiDummyTest extends AbstractTestCase * @param int $number error number * @param string $message error message * @param string $expected expected result - * - * @dataProvider errorData */ + #[DataProvider('errorData')] public function testFormatError(int $number, string $message, string $expected): void { $GLOBALS['server'] = 1; diff --git a/test/classes/Dbal/DbiMysqliTest.php b/test/classes/Dbal/DbiMysqliTest.php index 15fb1c4b67..de5533a5e1 100644 --- a/test/classes/Dbal/DbiMysqliTest.php +++ b/test/classes/Dbal/DbiMysqliTest.php @@ -10,11 +10,10 @@ use PhpMyAdmin\Dbal\Connection; use PhpMyAdmin\Dbal\DbiMysqli; use PhpMyAdmin\Dbal\MysqliResult; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** - * @covers \PhpMyAdmin\Dbal\DbiMysqli - * @covers \PhpMyAdmin\Dbal\Connection - */ +#[CoversClass(DbiMysqli::class)] +#[CoversClass(Connection::class)] class DbiMysqliTest extends AbstractTestCase { protected DbiMysqli $object; diff --git a/test/classes/Dbal/MysqliResultTest.php b/test/classes/Dbal/MysqliResultTest.php index 5ea239af81..5e4758bc53 100644 --- a/test/classes/Dbal/MysqliResultTest.php +++ b/test/classes/Dbal/MysqliResultTest.php @@ -5,10 +5,12 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Dbal; use mysqli_result; +use PhpMyAdmin\Dbal\DbiMysqli; use PhpMyAdmin\Dbal\MysqliResult; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Dbal\DbiMysqli */ +#[CoversClass(DbiMysqli::class)] class MysqliResultTest extends AbstractTestCase { /** diff --git a/test/classes/Dbal/MysqliStatementTest.php b/test/classes/Dbal/MysqliStatementTest.php index 0b1bf0a2fa..b09f86629e 100644 --- a/test/classes/Dbal/MysqliStatementTest.php +++ b/test/classes/Dbal/MysqliStatementTest.php @@ -7,12 +7,11 @@ namespace PhpMyAdmin\Tests\Dbal; use mysqli_stmt; use PhpMyAdmin\Dbal\MysqliResult; use PhpMyAdmin\Dbal\MysqliStatement; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \PhpMyAdmin\Dbal\MysqliStatement - * @covers \PhpMyAdmin\Dbal\MysqliResult - */ +#[CoversClass(MysqliStatement::class)] +#[CoversClass(MysqliResult::class)] class MysqliStatementTest extends TestCase { public function testGetResult(): void diff --git a/test/classes/Dbal/WarningTest.php b/test/classes/Dbal/WarningTest.php index e273591526..3917b720ad 100644 --- a/test/classes/Dbal/WarningTest.php +++ b/test/classes/Dbal/WarningTest.php @@ -5,16 +5,15 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Dbal; use PhpMyAdmin\Dbal\Warning; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Dbal\Warning */ +#[CoversClass(Warning::class)] class WarningTest extends TestCase { - /** - * @param mixed[] $row - * - * @dataProvider providerForTestWarning - */ + /** @param mixed[] $row */ + #[DataProvider('providerForTestWarning')] public function testWarning(array $row, string $level, int $code, string $message, string $toString): void { $warning = Warning::fromArray($row); diff --git a/test/classes/Display/DisplayPartsTest.php b/test/classes/Display/DisplayPartsTest.php index 691e289d8f..2da8f6e6e5 100644 --- a/test/classes/Display/DisplayPartsTest.php +++ b/test/classes/Display/DisplayPartsTest.php @@ -6,9 +6,10 @@ namespace PhpMyAdmin\Tests\Display; use PhpMyAdmin\Display\DeleteLinkEnum; use PhpMyAdmin\Display\DisplayParts; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Display\DisplayParts */ +#[CoversClass(DisplayParts::class)] class DisplayPartsTest extends TestCase { public function testFromArray(): void diff --git a/test/classes/Display/ResultsTest.php b/test/classes/Display/ResultsTest.php index bb6001774d..96b7b7ce64 100644 --- a/test/classes/Display/ResultsTest.php +++ b/test/classes/Display/ResultsTest.php @@ -24,6 +24,8 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\FieldHelper; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use ReflectionClass; use stdClass; @@ -45,7 +47,7 @@ use const MYSQLI_TYPE_STRING; use const MYSQLI_TYPE_TIME; use const MYSQLI_TYPE_TIMESTAMP; -/** @covers \PhpMyAdmin\Display\Results */ +#[CoversClass(DisplayResults::class)] class ResultsTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -216,9 +218,8 @@ class ResultsTest extends AbstractTestCase * @param mixed[] $rowInfo information about row * @param string $fieldName column name * @param string $output output of getSpecialLinkUrl - * - * @dataProvider dataProviderForTestGetSpecialLinkUrl */ + #[DataProvider('dataProviderForTestGetSpecialLinkUrl')] public function testGetSpecialLinkUrl( string $db, string $table, @@ -298,9 +299,8 @@ class ResultsTest extends AbstractTestCase * @param mixed[] $row current row data * @param mixed[] $colOrder the column order * @param mixed[] $output output of getRowInfoForSpecialLinks - * - * @dataProvider dataProviderForTestGetRowInfoForSpecialLinks */ + #[DataProvider('dataProviderForTestGetRowInfoForSpecialLinks')] public function testGetRowInfoForSpecialLinks( array $fieldsMeta, int $fieldsCount, @@ -361,9 +361,8 @@ class ResultsTest extends AbstractTestCase * @param int $limitChars Partial or Full text * @param string $str the string to be tested * @param mixed[] $output return value of getPartialText - * - * @dataProvider dataProviderForTestGetPartialText */ + #[DataProvider('dataProviderForTestGetPartialText')] public function testGetPartialText(string $pftext, int $limitChars, string $str, array $output): void { $_SESSION['tmpval']['pftext'] = $pftext; @@ -430,9 +429,8 @@ class ResultsTest extends AbstractTestCase * @param mixed[] $urlParams parameters that should go to the download link * @param bool $isTruncated the result is truncated or not * @param string $output the output of this function - * - * @dataProvider dataProviderForTestHandleNonPrintableContents */ + #[DataProvider('dataProviderForTestHandleNonPrintableContents')] public function testHandleNonPrintableContents( bool $displayBinary, bool $displayBlob, @@ -603,9 +601,8 @@ class ResultsTest extends AbstractTestCase * @param bool $conditionField the column should highlighted or not * @param mixed[] $transformOptions the transformation parameters * @param string $output the output of this function - * - * @dataProvider dataProviderForTestGetDataCellForNonNumericColumns */ + #[DataProvider('dataProviderForTestGetDataCellForNonNumericColumns')] public function testGetDataCellForNonNumericColumns( string $protectBinary, string|null $column, @@ -787,11 +784,8 @@ class ResultsTest extends AbstractTestCase ]; } - /** - * @param mixed[] $urlParams - * - * @dataProvider dataProviderGetSortOrderHiddenInputs - */ + /** @param mixed[] $urlParams */ + #[DataProvider('dataProviderGetSortOrderHiddenInputs')] public function testGetSortOrderHiddenInputs( string $sqlAdd, string $sqlRemove, @@ -894,9 +888,8 @@ class ResultsTest extends AbstractTestCase * @param mixed[] $post * @param mixed[] $request * @param mixed[] $expected - * - * @dataProvider providerSetConfigParamsForDisplayTable */ + #[DataProvider('providerSetConfigParamsForDisplayTable')] public function testSetConfigParamsForDisplayTable( array $session, array $get, @@ -1725,7 +1718,7 @@ class ResultsTest extends AbstractTestCase ]; } - /** @dataProvider dataProviderSortOrder */ + #[DataProvider('dataProviderSortOrder')] public function testGetSingleAndMultiSortUrls( string $orderSetting, string $querySortDirection, diff --git a/test/classes/EncodingTest.php b/test/classes/EncodingTest.php index 0353c6bbfb..41baf4654a 100644 --- a/test/classes/EncodingTest.php +++ b/test/classes/EncodingTest.php @@ -5,6 +5,9 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Encoding; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use function _setlocale; use function file_get_contents; @@ -18,7 +21,7 @@ use function unlink; use const LC_ALL; use const PHP_INT_SIZE; -/** @covers \PhpMyAdmin\Encoding */ +#[CoversClass(Encoding::class)] class EncodingTest extends AbstractTestCase { protected function setUp(): void @@ -37,9 +40,8 @@ class EncodingTest extends AbstractTestCase /** * Test for Encoding::convertString - * - * @group medium */ + #[Group('medium')] public function testNoConversion(): void { $this->assertEquals( @@ -58,7 +60,7 @@ class EncodingTest extends AbstractTestCase ); } - /** @requires extension recode */ + #[RequiresPhpExtension('recode')] public function testRecode(): void { Encoding::setEngine(Encoding::ENGINE_RECODE); @@ -76,10 +78,9 @@ class EncodingTest extends AbstractTestCase * This group is used on debian packaging to exclude the test * * @see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854821#27 - * - * @group extension-iconv - * @requires extension iconv */ + #[Group('extension-iconv')] + #[RequiresPhpExtension('iconv')] public function testIconv(): void { // Set PHP native locale diff --git a/test/classes/Engines/BdbTest.php b/test/classes/Engines/BdbTest.php index 84c164d27a..458cb8140b 100644 --- a/test/classes/Engines/BdbTest.php +++ b/test/classes/Engines/BdbTest.php @@ -6,10 +6,11 @@ namespace PhpMyAdmin\Tests\Engines; use PhpMyAdmin\Engines\Bdb; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use function __; -/** @covers \PhpMyAdmin\Engines\Bdb */ +#[CoversClass(Bdb::class)] class BdbTest extends AbstractTestCase { protected Bdb $object; diff --git a/test/classes/Engines/BinlogTest.php b/test/classes/Engines/BinlogTest.php index 88d792c8ae..a0b5f91a01 100644 --- a/test/classes/Engines/BinlogTest.php +++ b/test/classes/Engines/BinlogTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Engines; use PhpMyAdmin\Engines\Binlog; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Engines\Binlog */ +#[CoversClass(Binlog::class)] class BinlogTest extends AbstractTestCase { protected Binlog $object; diff --git a/test/classes/Engines/InnodbTest.php b/test/classes/Engines/InnodbTest.php index 08bbc0a92f..bc1781c914 100644 --- a/test/classes/Engines/InnodbTest.php +++ b/test/classes/Engines/InnodbTest.php @@ -6,10 +6,11 @@ namespace PhpMyAdmin\Tests\Engines; use PhpMyAdmin\Engines\Innodb; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use function __; -/** @covers \PhpMyAdmin\Engines\Innodb */ +#[CoversClass(Innodb::class)] class InnodbTest extends AbstractTestCase { protected Innodb $object; diff --git a/test/classes/Engines/MemoryTest.php b/test/classes/Engines/MemoryTest.php index 7fe673faeb..3421cd7dcc 100644 --- a/test/classes/Engines/MemoryTest.php +++ b/test/classes/Engines/MemoryTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Engines; use PhpMyAdmin\Engines\Memory; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Engines\Memory */ +#[CoversClass(Memory::class)] class MemoryTest extends AbstractTestCase { protected Memory $object; diff --git a/test/classes/Engines/MrgMyisamTest.php b/test/classes/Engines/MrgMyisamTest.php index b87ddc3c5c..8f1b640b61 100644 --- a/test/classes/Engines/MrgMyisamTest.php +++ b/test/classes/Engines/MrgMyisamTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Engines; use PhpMyAdmin\Engines\MrgMyisam; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Engines\MrgMyisam */ +#[CoversClass(MrgMyisam::class)] class MrgMyisamTest extends AbstractTestCase { protected MrgMyisam $object; diff --git a/test/classes/Engines/MyisamTest.php b/test/classes/Engines/MyisamTest.php index 008c92eaa1..96840c7993 100644 --- a/test/classes/Engines/MyisamTest.php +++ b/test/classes/Engines/MyisamTest.php @@ -6,10 +6,11 @@ namespace PhpMyAdmin\Tests\Engines; use PhpMyAdmin\Engines\Myisam; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use function __; -/** @covers \PhpMyAdmin\Engines\Myisam */ +#[CoversClass(Myisam::class)] class MyisamTest extends AbstractTestCase { protected Myisam $object; diff --git a/test/classes/Engines/NdbclusterTest.php b/test/classes/Engines/NdbclusterTest.php index 336cabf9c8..38a0258896 100644 --- a/test/classes/Engines/NdbclusterTest.php +++ b/test/classes/Engines/NdbclusterTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Engines; use PhpMyAdmin\Engines\Ndbcluster; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Engines\Ndbcluster */ +#[CoversClass(Ndbcluster::class)] class NdbclusterTest extends AbstractTestCase { protected Ndbcluster $object; diff --git a/test/classes/Engines/PbxtTest.php b/test/classes/Engines/PbxtTest.php index a80e4f0d23..a5c281e4c0 100644 --- a/test/classes/Engines/PbxtTest.php +++ b/test/classes/Engines/PbxtTest.php @@ -7,11 +7,13 @@ namespace PhpMyAdmin\Tests\Engines; use PhpMyAdmin\Core; use PhpMyAdmin\Engines\Pbxt; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function __; use function sprintf; -/** @covers \PhpMyAdmin\Engines\Pbxt */ +#[CoversClass(Pbxt::class)] class PbxtTest extends AbstractTestCase { protected Pbxt $object; @@ -162,9 +164,8 @@ class PbxtTest extends AbstractTestCase * * @param string $formattedSize the size expression (for example 8MB) * @param mixed[] $output Expected output - * - * @dataProvider providerFortTestResolveTypeSize */ + #[DataProvider('providerFortTestResolveTypeSize')] public function testResolveTypeSize(string $formattedSize, array $output): void { $this->assertEquals( diff --git a/test/classes/Engines/PerformanceSchemaTest.php b/test/classes/Engines/PerformanceSchemaTest.php index ef2fa29570..ba50a33573 100644 --- a/test/classes/Engines/PerformanceSchemaTest.php +++ b/test/classes/Engines/PerformanceSchemaTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Engines; use PhpMyAdmin\Engines\PerformanceSchema; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Engines\PerformanceSchema */ +#[CoversClass(PerformanceSchema::class)] class PerformanceSchemaTest extends AbstractTestCase { protected PerformanceSchema $object; diff --git a/test/classes/EnvironmentTest.php b/test/classes/EnvironmentTest.php index fb2649170d..18d51d82da 100644 --- a/test/classes/EnvironmentTest.php +++ b/test/classes/EnvironmentTest.php @@ -4,11 +4,13 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; +use PHPUnit\Framework\Attributes\CoversNothing; + use function version_compare; use const PHP_VERSION; -/** @coversNothing */ +#[CoversNothing] class EnvironmentTest extends AbstractTestCase { /** diff --git a/test/classes/ErrorHandlerTest.php b/test/classes/ErrorHandlerTest.php index 5e685713d1..7d6e1835bc 100644 --- a/test/classes/ErrorHandlerTest.php +++ b/test/classes/ErrorHandlerTest.php @@ -10,6 +10,9 @@ use PhpMyAdmin\ErrorHandler; use PhpMyAdmin\Exceptions\ExitException; use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseRendererStub; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use ReflectionProperty; use Throwable; @@ -23,7 +26,7 @@ use const E_USER_NOTICE; use const E_USER_WARNING; use const E_WARNING; -/** @covers \PhpMyAdmin\ErrorHandler */ +#[CoversClass(ErrorHandler::class)] class ErrorHandlerTest extends AbstractTestCase { protected ErrorHandler $object; @@ -79,9 +82,8 @@ class ErrorHandlerTest extends AbstractTestCase * @param string $outputShow expected output if showing of errors is enabled * @param string $outputHide expected output if showing of errors is * disabled and 'sendErrorReports' is set to 'never' - * - * @dataProvider providerForTestHandleError */ + #[DataProvider('providerForTestHandleError')] public function testGetDispErrorsForDisplayFalse( int $errno, string $errstr, @@ -114,9 +116,8 @@ class ErrorHandlerTest extends AbstractTestCase * @param int $errline error line * @param string $outputShow expected output if showing of errors is enabled * @param string $outputHide expected output if showing of errors is disabled - * - * @dataProvider providerForTestHandleError */ + #[DataProvider('providerForTestHandleError')] public function testGetDispErrorsForDisplayTrue( int $errno, string $errstr, @@ -150,9 +151,8 @@ class ErrorHandlerTest extends AbstractTestCase /** * Test for countErrors - * - * @group medium */ + #[Group('medium')] public function testCountErrors(): void { $this->object->addError('Compile Error', E_WARNING, 'error.txt', 15); @@ -164,9 +164,8 @@ class ErrorHandlerTest extends AbstractTestCase /** * Test for sliceErrors - * - * @group medium */ + #[Group('medium')] public function testSliceErrors(): void { $this->object->addError('Compile Error', E_WARNING, 'error.txt', 15); @@ -195,9 +194,8 @@ class ErrorHandlerTest extends AbstractTestCase /** * Test for sliceErrors with 10 elements as an example - * - * @group medium */ + #[Group('medium')] public function testSliceErrorsOtherExample(): void { for ($i = 0; $i < 10; $i++) { diff --git a/test/classes/ErrorReportTest.php b/test/classes/ErrorReportTest.php index 81be1c6140..8b1be40eb6 100644 --- a/test/classes/ErrorReportTest.php +++ b/test/classes/ErrorReportTest.php @@ -12,6 +12,8 @@ use PhpMyAdmin\Template; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Utils\HttpRequest; use PhpMyAdmin\Version; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function htmlspecialchars; use function json_encode; @@ -21,7 +23,7 @@ use const ENT_QUOTES; use const JSON_PRETTY_PRINT; use const JSON_UNESCAPED_SLASHES; -/** @covers \PhpMyAdmin\ErrorReport */ +#[CoversClass(ErrorReport::class)] class ErrorReportTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -311,9 +313,8 @@ class ErrorReportTest extends AbstractTestCase * * @param string $url The url to test * @param mixed[] $result The result - * - * @dataProvider urlsToSanitize */ + #[DataProvider('urlsToSanitize')] public function testSanitizeUrl(string $url, array $result): void { // $this->errorReport->sanitizeUrl diff --git a/test/classes/ErrorTest.php b/test/classes/ErrorTest.php index b666bd7908..2ccaddb7a9 100644 --- a/test/classes/ErrorTest.php +++ b/test/classes/ErrorTest.php @@ -5,12 +5,14 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Error; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function preg_match; use const DIRECTORY_SEPARATOR; -/** @covers \PhpMyAdmin\Error */ +#[CoversClass(Error::class)] class ErrorTest extends AbstractTestCase { protected Error $object; @@ -62,9 +64,8 @@ class ErrorTest extends AbstractTestCase * * @param string $file actual * @param string $expected expected - * - * @dataProvider filePathProvider */ + #[DataProvider('filePathProvider')] public function testSetFile(string $file, string $expected): void { $this->object->setFile($file); diff --git a/test/classes/Export/OptionsTest.php b/test/classes/Export/OptionsTest.php index dae9ea38d3..9f11932733 100644 --- a/test/classes/Export/OptionsTest.php +++ b/test/classes/Export/OptionsTest.php @@ -13,8 +13,9 @@ use PhpMyAdmin\Export\TemplateModel; use PhpMyAdmin\Plugins; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Util; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Export\Options */ +#[CoversClass(Options::class)] class OptionsTest extends AbstractTestCase { private Options $export; diff --git a/test/classes/ExportTest.php b/test/classes/ExportTest.php index 5af344e80c..01a7481c2b 100644 --- a/test/classes/ExportTest.php +++ b/test/classes/ExportTest.php @@ -10,15 +10,15 @@ use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Plugins\Export\ExportPhparray; use PhpMyAdmin\Plugins\Export\ExportSql; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use function htmlspecialchars; use const ENT_COMPAT; -/** - * @covers \PhpMyAdmin\Export - * @group large - */ +#[CoversClass(Export::class)] +#[Group('large')] class ExportTest extends AbstractTestCase { public function testMergeAliases(): void diff --git a/test/classes/FieldMetadataTest.php b/test/classes/FieldMetadataTest.php index dab1de6803..e1072a1299 100644 --- a/test/classes/FieldMetadataTest.php +++ b/test/classes/FieldMetadataTest.php @@ -4,13 +4,16 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; +use PhpMyAdmin\FieldMetadata; +use PHPUnit\Framework\Attributes\CoversClass; + use const MYSQLI_BLOB_FLAG; use const MYSQLI_NUM_FLAG; use const MYSQLI_TYPE_FLOAT; use const MYSQLI_TYPE_INT24; use const MYSQLI_TYPE_STRING; -/** @covers \PhpMyAdmin\FieldMetadata */ +#[CoversClass(FieldMetadata::class)] class FieldMetadataTest extends AbstractTestCase { public function testEmptyConstruct(): void diff --git a/test/classes/FileListingTest.php b/test/classes/FileListingTest.php index 0f18779cd7..d851425a22 100644 --- a/test/classes/FileListingTest.php +++ b/test/classes/FileListingTest.php @@ -5,6 +5,8 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\FileListing; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use function array_values; use function extension_loaded; @@ -12,7 +14,7 @@ use function is_bool; use const TEST_PATH; -/** @covers \PhpMyAdmin\FileListing */ +#[CoversClass(FileListing::class)] class FileListingTest extends AbstractTestCase { private FileListing $fileListing; @@ -89,7 +91,7 @@ class FileListingTest extends AbstractTestCase $this->assertEmpty($this->fileListing->supportedDecompressions()); } - /** @requires extension bz2 1 */ + #[RequiresPhpExtension('bz2')] public function testSupportedDecompressionsFull(): void { $GLOBALS['cfg']['ZipDump'] = true; diff --git a/test/classes/FileTest.php b/test/classes/FileTest.php index 66010e6007..6c0c91f091 100644 --- a/test/classes/FileTest.php +++ b/test/classes/FileTest.php @@ -5,11 +5,14 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\File; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use function bin2hex; use function file_get_contents; -/** @covers \PhpMyAdmin\File */ +#[CoversClass(File::class)] class FileTest extends AbstractTestCase { /** @@ -27,9 +30,8 @@ class FileTest extends AbstractTestCase * * @param string $file file string * @param string $mime expected mime - * - * @dataProvider compressedFiles */ + #[DataProvider('compressedFiles')] public function testMIME(string $file, string $mime): void { $arr = new File($file); @@ -40,9 +42,8 @@ class FileTest extends AbstractTestCase * Test for File::getContent * * @param string $file file string - * - * @dataProvider compressedFiles */ + #[DataProvider('compressedFiles')] public function testBinaryContent(string $file): void { $data = '0x' . bin2hex((string) file_get_contents($file)); @@ -54,11 +55,10 @@ class FileTest extends AbstractTestCase * Test for File::read * * @param string $file file string - * - * @dataProvider compressedFiles - * @requires extension bz2 1 - * @requires extension zip */ + #[DataProvider('compressedFiles')] + #[RequiresPhpExtension('bz2')] + #[RequiresPhpExtension('zip')] public function testReadCompressed(string $file): void { $file = new File($file); diff --git a/test/classes/FlashMessagesTest.php b/test/classes/FlashMessagesTest.php index 651ac8fe88..f6f9668db9 100644 --- a/test/classes/FlashMessagesTest.php +++ b/test/classes/FlashMessagesTest.php @@ -5,9 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\FlashMessages; +use PHPUnit\Framework\Attributes\CoversClass; use RuntimeException; -/** @covers \PhpMyAdmin\FlashMessages */ +#[CoversClass(FlashMessages::class)] class FlashMessagesTest extends AbstractTestCase { private const STORAGE_KEY = 'flashMessages'; diff --git a/test/classes/FontTest.php b/test/classes/FontTest.php index 48a31375aa..fb398203fd 100644 --- a/test/classes/FontTest.php +++ b/test/classes/FontTest.php @@ -5,8 +5,9 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Font; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Font */ +#[CoversClass(Font::class)] class FontTest extends AbstractTestCase { private Font $font; diff --git a/test/classes/FooterTest.php b/test/classes/FooterTest.php index 7e5ef1e283..a94070c4c3 100644 --- a/test/classes/FooterTest.php +++ b/test/classes/FooterTest.php @@ -8,11 +8,13 @@ use ArrayIterator; use PhpMyAdmin\ErrorHandler; use PhpMyAdmin\Footer; use PhpMyAdmin\Template; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionProperty; use function json_encode; -/** @covers \PhpMyAdmin\Footer */ +#[CoversClass(Footer::class)] class FooterTest extends AbstractTestCase { /** @var mixed[] store private attributes of PhpMyAdmin\Footer */ @@ -64,9 +66,8 @@ class FooterTest extends AbstractTestCase /** * Test for getDebugMessage - * - * @group medium */ + #[Group('medium')] public function testGetDebugMessage(): void { $GLOBALS['cfg']['DBG']['sql'] = true; @@ -139,9 +140,8 @@ class FooterTest extends AbstractTestCase /** * Test for displaying footer - * - * @group medium */ + #[Group('medium')] public function testDisplay(): void { $footer = new Footer(); diff --git a/test/classes/Gis/Ds/PolygonTest.php b/test/classes/Gis/Ds/PolygonTest.php index 4e77980daa..1e38fb70df 100644 --- a/test/classes/Gis/Ds/PolygonTest.php +++ b/test/classes/Gis/Ds/PolygonTest.php @@ -7,8 +7,10 @@ namespace PhpMyAdmin\Tests\Gis\Ds; use PhpMyAdmin\Gis\Ds\Point; use PhpMyAdmin\Gis\Ds\Polygon; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Gis\Ds\Polygon */ +#[CoversClass(Polygon::class)] class PolygonTest extends AbstractTestCase { /** @@ -42,9 +44,8 @@ class PolygonTest extends AbstractTestCase /** * test for Area - * - * @dataProvider providerForTestArea */ + #[DataProvider('providerForTestArea')] public function testArea(Polygon $ring, float $area): void { $this->assertEquals($area, $ring->area()); @@ -90,9 +91,8 @@ class PolygonTest extends AbstractTestCase /** * test for isPointInsidePolygon - * - * @dataProvider providerForTestIsPointInsidePolygon */ + #[DataProvider('providerForTestIsPointInsidePolygon')] public function testIsPointInsidePolygon(Point $point, Polygon $polygon, bool $isInside): void { $this->assertEquals($isInside, $point->isInsidePolygon($polygon)); @@ -128,9 +128,8 @@ class PolygonTest extends AbstractTestCase * test for getPointOnSurface * * @param Polygon $ring array of points forming the ring - * - * @dataProvider providerForTestGetPointOnSurface */ + #[DataProvider('providerForTestGetPointOnSurface')] public function testGetPointOnSurface(Polygon $ring): void { $point = $ring->getPointOnSurface(); @@ -156,9 +155,8 @@ class PolygonTest extends AbstractTestCase * test case for isOuterRing() method * * @param Polygon $ring coordinates of the points in a ring - * - * @dataProvider providerForIsOuterRing */ + #[DataProvider('providerForIsOuterRing')] public function testIsOuterRing(Polygon $ring): void { $this->assertTrue($ring->isOuterRing()); diff --git a/test/classes/Gis/GisFactoryTest.php b/test/classes/Gis/GisFactoryTest.php index fde701889f..41bce6aa8c 100644 --- a/test/classes/Gis/GisFactoryTest.php +++ b/test/classes/Gis/GisFactoryTest.php @@ -13,8 +13,10 @@ use PhpMyAdmin\Gis\GisMultiPolygon; use PhpMyAdmin\Gis\GisPoint; use PhpMyAdmin\Gis\GisPolygon; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Gis\GisFactory */ +#[CoversClass(GisFactory::class)] class GisFactoryTest extends AbstractTestCase { /** @@ -23,9 +25,8 @@ class GisFactoryTest extends AbstractTestCase * @param string $type geometry type * @param string $geom geometry object * @psalm-param class-string $geom - * - * @dataProvider providerForTestFactory */ + #[DataProvider('providerForTestFactory')] public function testFactory(string $type, string $geom): void { $this->assertInstanceOf($geom, GisFactory::factory($type)); diff --git a/test/classes/Gis/GisGeometryCollectionTest.php b/test/classes/Gis/GisGeometryCollectionTest.php index 02271a8af4..30aa79b558 100644 --- a/test/classes/Gis/GisGeometryCollectionTest.php +++ b/test/classes/Gis/GisGeometryCollectionTest.php @@ -7,13 +7,16 @@ namespace PhpMyAdmin\Tests\Gis; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Gis\GisGeometryCollection; use PhpMyAdmin\Image\ImageWrapper; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use TCPDF; -/** - * @covers \PhpMyAdmin\Gis\GisGeometryCollection - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ +#[CoversClass(GisGeometryCollection::class)] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] class GisGeometryCollectionTest extends GisGeomTestCase { /** @@ -36,9 +39,8 @@ class GisGeometryCollectionTest extends GisGeomTestCase * * @param string $spatial spatial data of a row * @param ScaleData $minMax expected results - * - * @dataProvider providerForTestScaleRow */ + #[DataProvider('providerForTestScaleRow')] public function testScaleRow(string $spatial, ScaleData $minMax): void { $object = GisGeometryCollection::singleton(); @@ -52,9 +54,8 @@ class GisGeometryCollectionTest extends GisGeomTestCase * @param int $index index in $gis_data * @param string|null $empty empty parameter * @param string $output expected output - * - * @dataProvider providerForTestGenerateWkt */ + #[DataProvider('providerForTestGenerateWkt')] public function testGenerateWkt(array $gisData, int $index, string|null $empty, string $output): void { $object = GisGeometryCollection::singleton(); @@ -83,9 +84,8 @@ class GisGeometryCollectionTest extends GisGeomTestCase * * @param string $wkt point in WKT form * @param array $params expected output array - * - * @dataProvider providerForTestGenerateParams */ + #[DataProvider('providerForTestGenerateParams')] public function testGenerateParams(string $wkt, array $params): void { $object = GisGeometryCollection::singleton(); @@ -208,7 +208,7 @@ class GisGeometryCollectionTest extends GisGeomTestCase ]; } - /** @requires extension gd */ + #[RequiresPhpExtension('gd')] public function testPrepareRowAsPng(): void { $object = GisGeometryCollection::singleton(); @@ -239,9 +239,8 @@ class GisGeometryCollectionTest extends GisGeomTestCase * @param int[] $color line color * @param array $scaleData scaling parameters * @param TCPDF $pdf expected output - * - * @dataProvider providerForPrepareRowAsPdf */ + #[DataProvider('providerForPrepareRowAsPdf')] public function testPrepareRowAsPdf( string $spatial, string $label, @@ -286,9 +285,8 @@ class GisGeometryCollectionTest extends GisGeomTestCase * @param int[] $color line color * @param array $scaleData scaling parameters * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsSvg */ + #[DataProvider('providerForPrepareRowAsSvg')] public function testPrepareRowAsSvg( string $spatial, string $label, @@ -330,9 +328,8 @@ class GisGeometryCollectionTest extends GisGeomTestCase * @param string $label field label * @param int[] $color line color * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsOl */ + #[DataProvider('providerForPrepareRowAsOl')] public function testPrepareRowAsOl( string $spatial, int $srid, diff --git a/test/classes/Gis/GisGeometryTest.php b/test/classes/Gis/GisGeometryTest.php index ea2073a127..8c2542ca69 100644 --- a/test/classes/Gis/GisGeometryTest.php +++ b/test/classes/Gis/GisGeometryTest.php @@ -7,9 +7,11 @@ namespace PhpMyAdmin\Tests\Gis; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Gis\GisGeometry; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\MockObject\MockObject; -/** @covers \PhpMyAdmin\Gis\GisGeometry */ +#[CoversClass(GisGeometry::class)] class GisGeometryTest extends AbstractTestCase { /** @var GisGeometry&MockObject */ @@ -43,9 +45,8 @@ class GisGeometryTest extends AbstractTestCase * @param string $pointSet Point set * @param ScaleData|null $minMax Existing min, max values * @param ScaleData|null $output Expected output array - * - * @dataProvider providerForTestSetMinMax */ + #[DataProvider('providerForTestSetMinMax')] public function testSetMinMax(string $pointSet, ScaleData|null $minMax, ScaleData|null $output): void { $this->assertEquals( @@ -77,9 +78,8 @@ class GisGeometryTest extends AbstractTestCase * * @param string $value Geometry data * @param mixed[] $output Expected output - * - * @dataProvider providerForTestParseWktAndSrid */ + #[DataProvider('providerForTestParseWktAndSrid')] public function testParseWktAndSrid(string $value, array $output): void { $this->assertEquals( @@ -120,9 +120,8 @@ class GisGeometryTest extends AbstractTestCase * @param mixed[]|null $scaleData Data related to scaling * @param bool $linear If true, as a 1D array, else as a 2D array * @param mixed[] $output Expected output - * - * @dataProvider providerForTestExtractPointsInternal */ + #[DataProvider('providerForTestExtractPointsInternal')] public function testExtractPointsInternal( string $pointSet, array|null $scaleData, diff --git a/test/classes/Gis/GisLineStringTest.php b/test/classes/Gis/GisLineStringTest.php index 8cb1409823..67dc4be2d1 100644 --- a/test/classes/Gis/GisLineStringTest.php +++ b/test/classes/Gis/GisLineStringTest.php @@ -7,13 +7,16 @@ namespace PhpMyAdmin\Tests\Gis; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Gis\GisLineString; use PhpMyAdmin\Image\ImageWrapper; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use TCPDF; -/** - * @covers \PhpMyAdmin\Gis\GisLineString - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ +#[CoversClass(GisLineString::class)] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] class GisLineStringTest extends GisGeomTestCase { /** @@ -62,9 +65,8 @@ class GisLineStringTest extends GisGeomTestCase * @param int $index index in $gis_data * @param string|null $empty empty parameter * @param string $output expected output - * - * @dataProvider providerForTestGenerateWkt */ + #[DataProvider('providerForTestGenerateWkt')] public function testGenerateWkt(array $gisData, int $index, string|null $empty, string $output): void { $object = GisLineString::singleton(); @@ -76,9 +78,8 @@ class GisLineStringTest extends GisGeomTestCase * * @param string $wkt point in WKT form * @param array $params expected output array - * - * @dataProvider providerForTestGenerateParams */ + #[DataProvider('providerForTestGenerateParams')] public function testGenerateParams(string $wkt, array $params): void { $object = GisLineString::singleton(); @@ -129,9 +130,8 @@ class GisLineStringTest extends GisGeomTestCase * * @param string $spatial spatial data of a row * @param ScaleData $minMax expected results - * - * @dataProvider providerForTestScaleRow */ + #[DataProvider('providerForTestScaleRow')] public function testScaleRow(string $spatial, ScaleData $minMax): void { $object = GisLineString::singleton(); @@ -148,7 +148,7 @@ class GisLineStringTest extends GisGeomTestCase return [['LINESTRING(12 35,48 75,69 23,25 45,14 53,35 78)', new ScaleData(69, 12, 78, 23)]]; } - /** @requires extension gd */ + #[RequiresPhpExtension('gd')] public function testPrepareRowAsPng(): void { $object = GisLineString::singleton(); @@ -177,9 +177,8 @@ class GisLineStringTest extends GisGeomTestCase * @param string $label label for the GIS LINESTRING object * @param int[] $color color for the GIS LINESTRING object * @param array $scaleData array containing data related to scaling - * - * @dataProvider providerForPrepareRowAsPdf */ + #[DataProvider('providerForPrepareRowAsPdf')] public function testPrepareRowAsPdf( string $spatial, string $label, @@ -223,9 +222,8 @@ class GisLineStringTest extends GisGeomTestCase * @param int[] $color color for the GIS LINESTRING object * @param array $scaleData array containing data related to scaling * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsSvg */ + #[DataProvider('providerForPrepareRowAsSvg')] public function testPrepareRowAsSvg( string $spatial, string $label, @@ -266,9 +264,8 @@ class GisLineStringTest extends GisGeomTestCase * @param string $label label for the GIS LINESTRING object * @param int[] $color color for the GIS LINESTRING object * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsOl */ + #[DataProvider('providerForPrepareRowAsOl')] public function testPrepareRowAsOl( string $spatial, int $srid, diff --git a/test/classes/Gis/GisMultiLineStringTest.php b/test/classes/Gis/GisMultiLineStringTest.php index 2a763dfee9..a57e2001ac 100644 --- a/test/classes/Gis/GisMultiLineStringTest.php +++ b/test/classes/Gis/GisMultiLineStringTest.php @@ -7,13 +7,16 @@ namespace PhpMyAdmin\Tests\Gis; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Gis\GisMultiLineString; use PhpMyAdmin\Image\ImageWrapper; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use TCPDF; -/** - * @covers \PhpMyAdmin\Gis\GisMultiLineString - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ +#[CoversClass(GisMultiLineString::class)] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] class GisMultiLineStringTest extends GisGeomTestCase { /** @@ -62,9 +65,8 @@ class GisMultiLineStringTest extends GisGeomTestCase * @param int $index index in $gis_data * @param string|null $empty empty parameter * @param string $output expected output - * - * @dataProvider providerForTestGenerateWkt */ + #[DataProvider('providerForTestGenerateWkt')] public function testGenerateWkt(array $gisData, int $index, string|null $empty, string $output): void { $object = GisMultiLineString::singleton(); @@ -96,9 +98,8 @@ class GisMultiLineStringTest extends GisGeomTestCase * * @param string $wkt point in WKT form * @param array $params expected output array - * - * @dataProvider providerForTestGenerateParams */ + #[DataProvider('providerForTestGenerateParams')] public function testGenerateParams(string $wkt, array $params): void { $object = GisMultiLineString::singleton(); @@ -134,9 +135,8 @@ class GisMultiLineStringTest extends GisGeomTestCase * * @param string $spatial spatial data of a row * @param ScaleData $minMax expected results - * - * @dataProvider providerForTestScaleRow */ + #[DataProvider('providerForTestScaleRow')] public function testScaleRow(string $spatial, ScaleData $minMax): void { $object = GisMultiLineString::singleton(); @@ -153,7 +153,7 @@ class GisMultiLineStringTest extends GisGeomTestCase return [['MULTILINESTRING((36 14,47 23,62 75),(36 10,17 23,178 53))', new ScaleData(178, 17, 75, 10)]]; } - /** @requires extension gd */ + #[RequiresPhpExtension('gd')] public function testPrepareRowAsPng(): void { $object = GisMultiLineString::singleton(); @@ -182,9 +182,8 @@ class GisMultiLineStringTest extends GisGeomTestCase * @param string $label label for the GIS MULTILINESTRING object * @param int[] $color color for the GIS MULTILINESTRING object * @param array $scaleData array containing data related to scaling - * - * @dataProvider providerForPrepareRowAsPdf */ + #[DataProvider('providerForPrepareRowAsPdf')] public function testPrepareRowAsPdf( string $spatial, string $label, @@ -228,9 +227,8 @@ class GisMultiLineStringTest extends GisGeomTestCase * @param int[] $color color for the GIS MULTILINESTRING object * @param array $scaleData array containing data related to scaling * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsSvg */ + #[DataProvider('providerForPrepareRowAsSvg')] public function testPrepareRowAsSvg( string $spatial, string $label, @@ -273,9 +271,8 @@ class GisMultiLineStringTest extends GisGeomTestCase * @param string $label label for the GIS MULTILINESTRING object * @param int[] $color color for the GIS MULTILINESTRING object * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsOl */ + #[DataProvider('providerForPrepareRowAsOl')] public function testPrepareRowAsOl( string $spatial, int $srid, diff --git a/test/classes/Gis/GisMultiPointTest.php b/test/classes/Gis/GisMultiPointTest.php index 1033dce89c..bf38121fd7 100644 --- a/test/classes/Gis/GisMultiPointTest.php +++ b/test/classes/Gis/GisMultiPointTest.php @@ -7,15 +7,18 @@ namespace PhpMyAdmin\Tests\Gis; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Gis\GisMultiPoint; use PhpMyAdmin\Image\ImageWrapper; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use TCPDF; use function file_exists; -/** - * @covers \PhpMyAdmin\Gis\GisMultiPoint - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ +#[CoversClass(GisMultiPoint::class)] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] class GisMultiPointTest extends GisGeomTestCase { /** @@ -51,9 +54,8 @@ class GisMultiPointTest extends GisGeomTestCase * @param int $index index in $gis_data * @param string|null $empty empty parameter * @param string $output expected output - * - * @dataProvider providerForTestGenerateWkt */ + #[DataProvider('providerForTestGenerateWkt')] public function testGenerateWkt(array $gisData, int $index, string|null $empty, string $output): void { $object = GisMultiPoint::singleton(); @@ -76,9 +78,8 @@ class GisMultiPointTest extends GisGeomTestCase * * @param string $wkt point in WKT form * @param array $params expected output array - * - * @dataProvider providerForTestGenerateParams */ + #[DataProvider('providerForTestGenerateParams')] public function testGenerateParams(string $wkt, array $params): void { $object = GisMultiPoint::singleton(); @@ -114,9 +115,8 @@ class GisMultiPointTest extends GisGeomTestCase * * @param string $spatial spatial data of a row * @param ScaleData $minMax expected results - * - * @dataProvider providerForTestScaleRow */ + #[DataProvider('providerForTestScaleRow')] public function testScaleRow(string $spatial, ScaleData $minMax): void { $object = GisMultiPoint::singleton(); @@ -133,7 +133,7 @@ class GisMultiPointTest extends GisGeomTestCase return [['MULTIPOINT(12 35,48 75,69 23,25 45,14 53,35 78)', new ScaleData(69, 12, 78, 23)]]; } - /** @requires extension gd */ + #[RequiresPhpExtension('gd')] public function testPrepareRowAsPng(): void { $object = GisMultiPoint::singleton(); @@ -162,9 +162,8 @@ class GisMultiPointTest extends GisGeomTestCase * @param string $label label for the GIS MULTIPOINT object * @param int[] $color color for the GIS MULTIPOINT object * @param array $scaleData array containing data related to scaling - * - * @dataProvider providerForPrepareRowAsPdf */ + #[DataProvider('providerForPrepareRowAsPdf')] public function testPrepareRowAsPdf( string $spatial, string $label, @@ -210,9 +209,8 @@ class GisMultiPointTest extends GisGeomTestCase * @param int[] $color color for the GIS MULTIPOINT object * @param array $scaleData array containing data related to scaling * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsSvg */ + #[DataProvider('providerForPrepareRowAsSvg')] public function testPrepareRowAsSvg( string $spatial, string $label, @@ -261,9 +259,8 @@ class GisMultiPointTest extends GisGeomTestCase * @param string $label label for the GIS MULTIPOINT object * @param int[] $color color for the GIS MULTIPOINT object * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsOl */ + #[DataProvider('providerForPrepareRowAsOl')] public function testPrepareRowAsOl( string $spatial, int $srid, diff --git a/test/classes/Gis/GisMultiPolygonTest.php b/test/classes/Gis/GisMultiPolygonTest.php index 832bea3e27..377544f077 100644 --- a/test/classes/Gis/GisMultiPolygonTest.php +++ b/test/classes/Gis/GisMultiPolygonTest.php @@ -7,13 +7,16 @@ namespace PhpMyAdmin\Tests\Gis; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Gis\GisMultiPolygon; use PhpMyAdmin\Image\ImageWrapper; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use TCPDF; -/** - * @covers \PhpMyAdmin\Gis\GisMultiPolygon - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ +#[CoversClass(GisMultiPolygon::class)] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] class GisMultiPolygonTest extends GisGeomTestCase { /** @@ -65,9 +68,8 @@ class GisMultiPolygonTest extends GisGeomTestCase * @param int $index index in $gis_data * @param string|null $empty empty parameter * @param string $output expected output - * - * @dataProvider providerForTestGenerateWkt */ + #[DataProvider('providerForTestGenerateWkt')] public function testGenerateWkt(array $gisData, int $index, string|null $empty, string $output): void { $object = GisMultiPolygon::singleton(); @@ -126,9 +128,8 @@ class GisMultiPolygonTest extends GisGeomTestCase * * @param string $wkt point in WKT form * @param array $params expected output array - * - * @dataProvider providerForTestGenerateParams */ + #[DataProvider('providerForTestGenerateParams')] public function testGenerateParams(string $wkt, array $params): void { $object = GisMultiPolygon::singleton(); @@ -156,9 +157,8 @@ class GisMultiPolygonTest extends GisGeomTestCase * * @param mixed[] $rowData array of GIS data * @param string $shape expected shape in WKT - * - * @dataProvider providerForTestGetShape */ + #[DataProvider('providerForTestGetShape')] public function testGetShape(array $rowData, string $shape): void { $object = GisMultiPolygon::singleton(); @@ -214,9 +214,8 @@ class GisMultiPolygonTest extends GisGeomTestCase * * @param string $spatial spatial data of a row * @param ScaleData $minMax expected results - * - * @dataProvider providerForTestScaleRow */ + #[DataProvider('providerForTestScaleRow')] public function testScaleRow(string $spatial, ScaleData $minMax): void { $object = GisMultiPolygon::singleton(); @@ -243,7 +242,7 @@ class GisMultiPolygonTest extends GisGeomTestCase ]; } - /** @requires extension gd */ + #[RequiresPhpExtension('gd')] public function testPrepareRowAsPng(): void { $object = GisMultiPolygon::singleton(); @@ -274,9 +273,8 @@ class GisMultiPolygonTest extends GisGeomTestCase * @param string $label label for the GIS MULTIPOLYGON object * @param int[] $color color for the GIS MULTIPOLYGON object * @param array $scaleData array containing data related to scaling - * - * @dataProvider providerForPrepareRowAsPdf */ + #[DataProvider('providerForPrepareRowAsPdf')] public function testPrepareRowAsPdf( string $spatial, string $label, @@ -322,9 +320,8 @@ class GisMultiPolygonTest extends GisGeomTestCase * @param int[] $color color for the GIS MULTIPOLYGON object * @param array $scaleData array containing data related to scaling * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsSvg */ + #[DataProvider('providerForPrepareRowAsSvg')] public function testPrepareRowAsSvg( string $spatial, string $label, @@ -370,9 +367,8 @@ class GisMultiPolygonTest extends GisGeomTestCase * @param string $label label for the GIS MULTIPOLYGON object * @param int[] $color color for the GIS MULTIPOLYGON object * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsOl */ + #[DataProvider('providerForPrepareRowAsOl')] public function testPrepareRowAsOl( string $spatial, int $srid, diff --git a/test/classes/Gis/GisPointTest.php b/test/classes/Gis/GisPointTest.php index 589d82d137..66bfac2212 100644 --- a/test/classes/Gis/GisPointTest.php +++ b/test/classes/Gis/GisPointTest.php @@ -7,15 +7,18 @@ namespace PhpMyAdmin\Tests\Gis; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Gis\GisPoint; use PhpMyAdmin\Image\ImageWrapper; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use TCPDF; use function file_exists; -/** - * @covers \PhpMyAdmin\Gis\GisPoint - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ +#[CoversClass(GisPoint::class)] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] class GisPointTest extends GisGeomTestCase { /** @@ -41,9 +44,8 @@ class GisPointTest extends GisGeomTestCase * @param int $index index in $gis_data * @param string|null $empty empty parameter * @param string $output expected output - * - * @dataProvider providerForTestGenerateWkt */ + #[DataProvider('providerForTestGenerateWkt')] public function testGenerateWkt(array $gisData, int $index, string|null $empty, string $output): void { $object = GisPoint::singleton(); @@ -55,9 +57,8 @@ class GisPointTest extends GisGeomTestCase * * @param mixed[] $rowData array of GIS data * @param string $shape expected shape in WKT - * - * @dataProvider providerForTestGetShape */ + #[DataProvider('providerForTestGetShape')] public function testGetShape(array $rowData, string $shape): void { $object = GisPoint::singleton(); @@ -79,9 +80,8 @@ class GisPointTest extends GisGeomTestCase * * @param string $wkt point in WKT form * @param array $params expected output array - * - * @dataProvider providerForTestGenerateParams */ + #[DataProvider('providerForTestGenerateParams')] public function testGenerateParams(string $wkt, array $params): void { $object = GisPoint::singleton(); @@ -128,9 +128,8 @@ class GisPointTest extends GisGeomTestCase * * @param string $spatial spatial data of a row * @param ScaleData $minMax expected results - * - * @dataProvider providerForTestScaleRow */ + #[DataProvider('providerForTestScaleRow')] public function testScaleRow(string $spatial, ScaleData $minMax): void { $object = GisPoint::singleton(); @@ -147,7 +146,7 @@ class GisPointTest extends GisGeomTestCase return [['POINT(12 35)', new ScaleData(12, 12, 35, 35)]]; } - /** @requires extension gd */ + #[RequiresPhpExtension('gd')] public function testPrepareRowAsPng(): void { $object = GisPoint::singleton(); @@ -176,9 +175,8 @@ class GisPointTest extends GisGeomTestCase * @param string $label label for the GIS POINT object * @param int[] $color color for the GIS POINT object * @param array $scaleData array containing data related to scaling - * - * @dataProvider providerForPrepareRowAsPdf */ + #[DataProvider('providerForPrepareRowAsPdf')] public function testPrepareRowAsPdf( string $spatial, string $label, @@ -224,9 +222,8 @@ class GisPointTest extends GisGeomTestCase * @param int[] $color color for the GIS POINT object * @param array $scaleData array containing data related to scaling * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsSvg */ + #[DataProvider('providerForPrepareRowAsSvg')] public function testPrepareRowAsSvg( string $spatial, string $label, @@ -257,9 +254,8 @@ class GisPointTest extends GisGeomTestCase * @param string $label label for the GIS POINT object * @param int[] $color color for the GIS POINT object * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsOl */ + #[DataProvider('providerForPrepareRowAsOl')] public function testPrepareRowAsOl( string $spatial, int $srid, diff --git a/test/classes/Gis/GisPolygonTest.php b/test/classes/Gis/GisPolygonTest.php index d4a43d76b5..623fab91db 100644 --- a/test/classes/Gis/GisPolygonTest.php +++ b/test/classes/Gis/GisPolygonTest.php @@ -7,13 +7,16 @@ namespace PhpMyAdmin\Tests\Gis; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Gis\GisPolygon; use PhpMyAdmin\Image\ImageWrapper; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use TCPDF; -/** - * @covers \PhpMyAdmin\Gis\GisPolygon - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ +#[CoversClass(GisPolygon::class)] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] class GisPolygonTest extends GisGeomTestCase { /** @@ -52,9 +55,8 @@ class GisPolygonTest extends GisGeomTestCase * @param int $index index in $gis_data * @param string|null $empty empty parameter * @param string $output expected output - * - * @dataProvider providerForTestGenerateWkt */ + #[DataProvider('providerForTestGenerateWkt')] public function testGenerateWkt(array $gisData, int $index, string|null $empty, string $output): void { $object = GisPolygon::singleton(); @@ -99,9 +101,8 @@ class GisPolygonTest extends GisGeomTestCase * * @param string $wkt point in WKT form * @param array $params expected output array - * - * @dataProvider providerForTestGenerateParams */ + #[DataProvider('providerForTestGenerateParams')] public function testGenerateParams(string $wkt, array $params): void { $object = GisPolygon::singleton(); @@ -128,9 +129,8 @@ class GisPolygonTest extends GisGeomTestCase * * @param string $spatial spatial data of a row * @param ScaleData $minMax expected results - * - * @dataProvider providerForTestScaleRow */ + #[DataProvider('providerForTestScaleRow')] public function testScaleRow(string $spatial, ScaleData $minMax): void { $object = GisPolygon::singleton(); @@ -150,7 +150,7 @@ class GisPolygonTest extends GisGeomTestCase ]; } - /** @requires extension gd */ + #[RequiresPhpExtension('gd')] public function testPrepareRowAsPng(): void { $object = GisPolygon::singleton(); @@ -179,9 +179,8 @@ class GisPolygonTest extends GisGeomTestCase * @param string $label label for the GIS POLYGON object * @param int[] $color color for the GIS POLYGON object * @param array $scaleData array containing data related to scaling - * - * @dataProvider providerForPrepareRowAsPdf */ + #[DataProvider('providerForPrepareRowAsPdf')] public function testPrepareRowAsPdf( string $spatial, string $label, @@ -226,9 +225,8 @@ class GisPolygonTest extends GisGeomTestCase * @param int[] $color color for the GIS POLYGON object * @param array $scaleData array containing data related to scaling * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsSvg */ + #[DataProvider('providerForPrepareRowAsSvg')] public function testPrepareRowAsSvg( string $spatial, string $label, @@ -269,9 +267,8 @@ class GisPolygonTest extends GisGeomTestCase * @param string $label label for the GIS POLYGON object * @param int[] $color color for the GIS POLYGON object * @param string $output expected output - * - * @dataProvider providerForPrepareRowAsOl */ + #[DataProvider('providerForPrepareRowAsOl')] public function testPrepareRowAsOl( string $spatial, int $srid, diff --git a/test/classes/Gis/GisVisualizationTest.php b/test/classes/Gis/GisVisualizationTest.php index aae3c45735..08fe87fa5f 100644 --- a/test/classes/Gis/GisVisualizationTest.php +++ b/test/classes/Gis/GisVisualizationTest.php @@ -7,8 +7,9 @@ namespace PhpMyAdmin\Tests\Gis; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Gis\GisVisualization; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Gis\GisVisualization */ +#[CoversClass(GisVisualization::class)] class GisVisualizationTest extends AbstractTestCase { /** @psalm-suppress PropertyNotSetInConstructor */ diff --git a/test/classes/GitTest.php b/test/classes/GitTest.php index d788a792f5..5c6a057af6 100644 --- a/test/classes/GitTest.php +++ b/test/classes/GitTest.php @@ -5,6 +5,8 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Git; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use function file_put_contents; use function mkdir; @@ -16,10 +18,8 @@ use function unlink; use const DIRECTORY_SEPARATOR; -/** - * @covers \PhpMyAdmin\Git - * @group git-revision - */ +#[CoversClass(Git::class)] +#[Group('git-revision')] class GitTest extends AbstractTestCase { protected Git $object; @@ -88,9 +88,8 @@ class GitTest extends AbstractTestCase /** * Test for isGitRevision - * - * @group git-revision */ + #[Group('git-revision')] public function testIsGitRevisionLocalGitDir(): void { $this->assertFalse( @@ -125,9 +124,8 @@ class GitTest extends AbstractTestCase /** * Test for isGitRevision - * - * @group git-revision */ + #[Group('git-revision')] public function testIsGitRevisionExternalGitDir(): void { file_put_contents($this->testDir . '.git', 'gitdir: ' . $this->testDir . '.customgitdir'); @@ -163,9 +161,8 @@ class GitTest extends AbstractTestCase /** * Test for checkGitRevision packs folder - * - * @group git-revision */ + #[Group('git-revision')] public function testCheckGitRevisionPacksFolder(): void { mkdir($this->testDir . '.git'); @@ -226,9 +223,8 @@ class GitTest extends AbstractTestCase /** * Test for checkGitRevision packs folder - * - * @group git-revision */ + #[Group('git-revision')] public function testCheckGitRevisionRefFile(): void { mkdir($this->testDir . '.git'); @@ -264,9 +260,8 @@ class GitTest extends AbstractTestCase /** * Test for checkGitRevision with packs as file - * - * @group git-revision */ + #[Group('git-revision')] public function testCheckGitRevisionPacksFile(): void { mkdir($this->testDir . '.git'); diff --git a/test/classes/HeaderTest.php b/test/classes/HeaderTest.php index 8ab5d1b162..96cee482b6 100644 --- a/test/classes/HeaderTest.php +++ b/test/classes/HeaderTest.php @@ -6,16 +6,17 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\Console; use PhpMyAdmin\Header; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use ReflectionProperty; use function gmdate; use const DATE_RFC1123; -/** - * @covers \PhpMyAdmin\Header - * @group medium - */ +#[CoversClass(Header::class)] +#[Group('medium')] class HeaderTest extends AbstractTestCase { /** @@ -132,10 +133,7 @@ class HeaderTest extends AbstractTestCase $this->assertFalse($reflection->getValue($header)); } - /** - * @covers \PhpMyAdmin\Core::getNoCacheHeaders - * @dataProvider providerForTestGetHttpHeaders - */ + #[DataProvider('providerForTestGetHttpHeaders')] public function testGetHttpHeaders( string|bool $frameOptions, string $cspAllow, diff --git a/test/classes/Html/GeneratorTest.php b/test/classes/Html/GeneratorTest.php index 4cdbd3428c..2ef3dd0716 100644 --- a/test/classes/Html/GeneratorTest.php +++ b/test/classes/Html/GeneratorTest.php @@ -12,6 +12,9 @@ use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Types; use PhpMyAdmin\Util; use PhpMyAdmin\Utils\SessionCache; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use function __; use function _pgettext; @@ -19,7 +22,7 @@ use function call_user_func_array; use function htmlspecialchars; use function urlencode; -/** @covers \PhpMyAdmin\Html\Generator */ +#[CoversClass(Generator::class)] class GeneratorTest extends AbstractTestCase { /** @@ -34,9 +37,8 @@ class GeneratorTest extends AbstractTestCase /** * Test for getDbLink - * - * @group medium */ + #[Group('medium')] public function testGetDbLinkNull(): void { $GLOBALS['db'] = 'test_db'; @@ -186,9 +188,8 @@ class GeneratorTest extends AbstractTestCase * @param mixed[] $params params * @param int $limit limit * @param string $match match - * - * @dataProvider linksOrButtons */ + #[DataProvider('linksOrButtons')] public function testLinkOrButton(array $params, int $limit, string $match): void { $restore = $GLOBALS['cfg']['LinkLengthLimit'] ?? 1000; @@ -375,9 +376,8 @@ class GeneratorTest extends AbstractTestCase /** * Test for Generator::getDefaultFunctionForField - * - * @dataProvider providerForTestGetDefaultFunctionForField */ + #[DataProvider('providerForTestGetDefaultFunctionForField')] public function testGetDefaultFunctionForField( string $trueType, bool $firstTimestamp, diff --git a/test/classes/Html/MySQLDocumentationTest.php b/test/classes/Html/MySQLDocumentationTest.php index c4f710479b..df14d3c7e2 100644 --- a/test/classes/Html/MySQLDocumentationTest.php +++ b/test/classes/Html/MySQLDocumentationTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Html; use PhpMyAdmin\Html\MySQLDocumentation; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Html\MySQLDocumentation */ +#[CoversClass(MySQLDocumentation::class)] class MySQLDocumentationTest extends AbstractTestCase { public function testShowDocumentation(): void diff --git a/test/classes/Html/SecurityTest.php b/test/classes/Html/SecurityTest.php index 4a82446915..7f5b51b1b6 100644 --- a/test/classes/Html/SecurityTest.php +++ b/test/classes/Html/SecurityTest.php @@ -7,8 +7,9 @@ namespace PhpMyAdmin\Tests\Html; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversNothing; -/** @coversNothing */ +#[CoversNothing] class SecurityTest extends AbstractTestCase { protected Template $template; diff --git a/test/classes/Http/Factory/ServerRequestFactoryTest.php b/test/classes/Http/Factory/ServerRequestFactoryTest.php index f141be5174..15558aadb1 100644 --- a/test/classes/Http/Factory/ServerRequestFactoryTest.php +++ b/test/classes/Http/Factory/ServerRequestFactoryTest.php @@ -10,13 +10,15 @@ use Nyholm\Psr7\Factory\Psr17Factory as NyholmPsr17Factory; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use Psr\Http\Message\ServerRequestFactoryInterface; use Psr\Http\Message\ServerRequestInterface; use Slim\Psr7\Factory\ServerRequestFactory as SlimServerRequestFactory; use function class_exists; -/** @covers \PhpMyAdmin\Http\Factory\ServerRequestFactory */ +#[CoversClass(ServerRequestFactory::class)] class ServerRequestFactoryTest extends AbstractTestCase { private const IMPLEMENTATION_CLASSES = [ @@ -54,11 +56,8 @@ class ServerRequestFactoryTest extends AbstractTestCase } } - /** - * @phpstan-param class-string $className - * - * @dataProvider dataProviderPsr7Implementations - */ + /** @phpstan-param class-string $className */ + #[DataProvider('dataProviderPsr7Implementations')] public function testPsr7ImplementationGet(string $className, string $humanName): void { $this->runOrSkip($className, $humanName); @@ -164,11 +163,8 @@ class ServerRequestFactoryTest extends AbstractTestCase $this->assertSame('', $request->getParsedBodyParam('input3', 'default')); } - /** - * @phpstan-param class-string $className - * - * @dataProvider dataProviderPsr7Implementations - */ + /** @phpstan-param class-string $className */ + #[DataProvider('dataProviderPsr7Implementations')] public function testPsr7ImplementationCreateServerRequestFactory(string $className, string $humanName): void { $this->runOrSkip($className, $humanName); diff --git a/test/classes/Http/ServerRequestTest.php b/test/classes/Http/ServerRequestTest.php index 32ecdae4e2..4d105d34fd 100644 --- a/test/classes/Http/ServerRequestTest.php +++ b/test/classes/Http/ServerRequestTest.php @@ -5,18 +5,19 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Http; use PhpMyAdmin\Http\ServerRequest; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Http\Message\ServerRequestInterface; -/** @covers \PhpMyAdmin\Http\ServerRequest */ +#[CoversClass(ServerRequest::class)] class ServerRequestTest extends TestCase { /** * @param array $get * @param array $post - * - * @dataProvider providerForTestGetRoute */ + #[DataProvider('providerForTestGetRoute')] public function testGetRoute(string $expected, array $get, array $post): void { $requestStub = $this->createStub(ServerRequestInterface::class); diff --git a/test/classes/Identifiers/DatabaseNameTest.php b/test/classes/Identifiers/DatabaseNameTest.php index 09139a437c..52b6ee0221 100644 --- a/test/classes/Identifiers/DatabaseNameTest.php +++ b/test/classes/Identifiers/DatabaseNameTest.php @@ -6,17 +6,17 @@ namespace PhpMyAdmin\Tests\Identifiers; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Identifiers\InvalidDatabaseName; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function str_repeat; -/** - * @covers \PhpMyAdmin\Identifiers\DatabaseName - * @covers \PhpMyAdmin\Identifiers\InvalidDatabaseName - */ +#[CoversClass(DatabaseName::class)] +#[CoversClass(InvalidDatabaseName::class)] class DatabaseNameTest extends TestCase { - /** @dataProvider providerForTestValidNames */ + #[DataProvider('providerForTestValidNames')] public function testValidName(string $validName): void { $name = DatabaseName::from($validName); @@ -24,7 +24,7 @@ class DatabaseNameTest extends TestCase $this->assertEquals($validName, (string) $name); } - /** @dataProvider providerForTestValidNames */ + #[DataProvider('providerForTestValidNames')] public function testTryFromValueWithValidName(string $validName): void { $name = DatabaseName::tryFrom($validName); @@ -41,7 +41,7 @@ class DatabaseNameTest extends TestCase yield [str_repeat('a', 64)]; } - /** @dataProvider providerForTestInvalidNames */ + #[DataProvider('providerForTestInvalidNames')] public function testInvalidNames(mixed $name, string $exceptionMessage): void { $this->assertNull(DatabaseName::tryFrom($name)); diff --git a/test/classes/Identifiers/TableNameTest.php b/test/classes/Identifiers/TableNameTest.php index 0b1ff46116..4d601ff5c5 100644 --- a/test/classes/Identifiers/TableNameTest.php +++ b/test/classes/Identifiers/TableNameTest.php @@ -6,17 +6,17 @@ namespace PhpMyAdmin\Tests\Identifiers; use PhpMyAdmin\Identifiers\InvalidTableName; use PhpMyAdmin\Identifiers\TableName; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function str_repeat; -/** - * @covers \PhpMyAdmin\Identifiers\TableName - * @covers \PhpMyAdmin\Identifiers\InvalidTableName - */ +#[CoversClass(TableName::class)] +#[CoversClass(InvalidTableName::class)] class TableNameTest extends TestCase { - /** @dataProvider providerForTestValidNames */ + #[DataProvider('providerForTestValidNames')] public function testValidName(string $validName): void { $name = TableName::from($validName); @@ -24,7 +24,7 @@ class TableNameTest extends TestCase $this->assertEquals($validName, (string) $name); } - /** @dataProvider providerForTestValidNames */ + #[DataProvider('providerForTestValidNames')] public function testTryFromValueValidName(string $validName): void { $name = TableName::tryFrom($validName); @@ -41,7 +41,7 @@ class TableNameTest extends TestCase yield [str_repeat('a', 64)]; } - /** @dataProvider providerForTestInvalidNames */ + #[DataProvider('providerForTestInvalidNames')] public function testInvalidNames(mixed $name, string $exceptionMessage): void { $this->assertNull(TableName::tryFrom($name)); diff --git a/test/classes/Identifiers/TriggerNameTest.php b/test/classes/Identifiers/TriggerNameTest.php index 6d44e60d80..342188cfec 100644 --- a/test/classes/Identifiers/TriggerNameTest.php +++ b/test/classes/Identifiers/TriggerNameTest.php @@ -6,17 +6,17 @@ namespace PhpMyAdmin\Tests\Identifiers; use PhpMyAdmin\Identifiers\InvalidTriggerName; use PhpMyAdmin\Identifiers\TriggerName; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function str_repeat; -/** - * @covers \PhpMyAdmin\Identifiers\InvalidTriggerName - * @covers \PhpMyAdmin\Identifiers\TriggerName - */ +#[CoversClass(InvalidTriggerName::class)] +#[CoversClass(TriggerName::class)] final class TriggerNameTest extends TestCase { - /** @dataProvider providerForTestValidNames */ + #[DataProvider('providerForTestValidNames')] public function testValidName(string $validName): void { $name = TriggerName::from($validName); @@ -24,7 +24,7 @@ final class TriggerNameTest extends TestCase $this->assertEquals($validName, (string) $name); } - /** @dataProvider providerForTestValidNames */ + #[DataProvider('providerForTestValidNames')] public function testTryFromValueValidName(string $validName): void { $name = TriggerName::tryFrom($validName); @@ -41,7 +41,7 @@ final class TriggerNameTest extends TestCase yield [str_repeat('a', 64)]; } - /** @dataProvider providerForTestInvalidNames */ + #[DataProvider('providerForTestInvalidNames')] public function testInvalidNames(mixed $name, string $exceptionMessage): void { $this->assertNull(TriggerName::tryFrom($name)); diff --git a/test/classes/Import/AjaxTest.php b/test/classes/Import/AjaxTest.php index 951c30a163..ec1c4a2dfb 100644 --- a/test/classes/Import/AjaxTest.php +++ b/test/classes/Import/AjaxTest.php @@ -5,9 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Import; use PhpMyAdmin\Import\Ajax; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Import\Ajax */ +#[CoversClass(Ajax::class)] class AjaxTest extends TestCase { public function testNopluginCheck(): void diff --git a/test/classes/Import/SimulateDmlTest.php b/test/classes/Import/SimulateDmlTest.php index df3b3b273c..5f6f86874a 100644 --- a/test/classes/Import/SimulateDmlTest.php +++ b/test/classes/Import/SimulateDmlTest.php @@ -12,8 +12,10 @@ use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Import\SimulateDml */ +#[CoversClass(SimulateDml::class)] class SimulateDmlTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -29,7 +31,7 @@ class SimulateDmlTest extends AbstractTestCase $GLOBALS['dbi'] = $this->dbi; } - /** @dataProvider providerForTestGetMatchedRows */ + #[DataProvider('providerForTestGetMatchedRows')] public function testGetMatchedRows(string $sqlQuery, string $simulatedQuery): void { $GLOBALS['db'] = 'PMA'; diff --git a/test/classes/ImportTest.php b/test/classes/ImportTest.php index 65a6b61db7..5c33c8eb36 100644 --- a/test/classes/ImportTest.php +++ b/test/classes/ImportTest.php @@ -5,12 +5,14 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Import; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function time; use const PHP_INT_MAX; -/** @covers \PhpMyAdmin\Import */ +#[CoversClass(Import::class)] class ImportTest extends AbstractTestCase { private Import $import; @@ -121,9 +123,8 @@ class ImportTest extends AbstractTestCase * * @param string $expected Expected result of the function * @param int $num The column number - * - * @dataProvider provGetColumnAlphaName */ + #[DataProvider('provGetColumnAlphaName')] public function testGetColumnAlphaName(string $expected, int $num): void { $this->assertEquals($expected, $this->import->getColumnAlphaName($num)); @@ -144,9 +145,8 @@ class ImportTest extends AbstractTestCase * * @param int $expected Expected result of the function * @param string $name column name(i.e. "A", or "BC", etc.) - * - * @dataProvider provGetColumnNumberFromName */ + #[DataProvider('provGetColumnNumberFromName')] public function testGetColumnNumberFromName(int $expected, string $name): void { $this->assertEquals($expected, $this->import->getColumnNumberFromName($name)); @@ -167,9 +167,8 @@ class ImportTest extends AbstractTestCase * * @param int $expected Expected result of the function * @param string $size Size of field - * - * @dataProvider provGetDecimalPrecision */ + #[DataProvider('provGetDecimalPrecision')] public function testGetDecimalPrecision(int $expected, string $size): void { $this->assertEquals($expected, $this->import->getDecimalPrecision($size)); @@ -190,9 +189,8 @@ class ImportTest extends AbstractTestCase * * @param int $expected Expected result of the function * @param string $size Size of field - * - * @dataProvider provGetDecimalScale */ + #[DataProvider('provGetDecimalScale')] public function testGetDecimalScale(int $expected, string $size): void { $this->assertEquals($expected, $this->import->getDecimalScale($size)); @@ -213,9 +211,8 @@ class ImportTest extends AbstractTestCase * * @param mixed[] $expected Expected result of the function * @param string $cell Cell content - * - * @dataProvider provGetDecimalSize */ + #[DataProvider('provGetDecimalSize')] public function testGetDecimalSize(array $expected, string $cell): void { $this->assertEquals($expected, $this->import->getDecimalSize($cell)); @@ -239,9 +236,8 @@ class ImportTest extends AbstractTestCase * BIGINT or DECIMAL or NONE) * @param string|null $cell String representation of the cell for which a * best-fit type is to be determined - * - * @dataProvider provDetectType */ + #[DataProvider('provDetectType')] public function testDetectType(int $expected, int|null $type, string|null $cell): void { $this->assertEquals($expected, $this->import->detectType($type, $cell)); @@ -320,9 +316,8 @@ class ImportTest extends AbstractTestCase * * @param string $input The contents to strip BOM * @param string $cleanContents The contents cleaned - * - * @dataProvider providerContentWithByteOrderMarks */ + #[DataProvider('providerContentWithByteOrderMarks')] public function testSkipByteOrderMarksFromContents(string $input, string $cleanContents): void { $this->assertEquals($cleanContents, $this->import->skipByteOrderMarksFromContents($input)); diff --git a/test/classes/IndexColumnTest.php b/test/classes/IndexColumnTest.php index 623fc34028..a89964d57d 100644 --- a/test/classes/IndexColumnTest.php +++ b/test/classes/IndexColumnTest.php @@ -5,9 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\IndexColumn; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\IndexColumn */ +#[CoversClass(IndexColumn::class)] class IndexColumnTest extends TestCase { private IndexColumn $object; diff --git a/test/classes/IndexTest.php b/test/classes/IndexTest.php index fe5592fda3..67aa4e040c 100644 --- a/test/classes/IndexTest.php +++ b/test/classes/IndexTest.php @@ -5,8 +5,9 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Index; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Index */ +#[CoversClass(Index::class)] class IndexTest extends AbstractTestCase { /** @var mixed[] */ diff --git a/test/classes/InsertEditTest.php b/test/classes/InsertEditTest.php index 9de344eece..a41866c9c5 100644 --- a/test/classes/InsertEditTest.php +++ b/test/classes/InsertEditTest.php @@ -20,6 +20,9 @@ use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Transformations; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use ReflectionProperty; use function hash; @@ -37,10 +40,8 @@ use const MYSQLI_TYPE_DECIMAL; use const MYSQLI_TYPE_TIMESTAMP; use const MYSQLI_TYPE_TINY; -/** - * @covers \PhpMyAdmin\InsertEdit - * @group medium - */ +#[CoversClass(InsertEdit::class)] +#[Group('medium')] class InsertEditTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -344,9 +345,8 @@ class InsertEditTest extends AbstractTestCase * Test for loadFirstRow * * @param array $rowsValue - * - * @dataProvider dataProviderConfigValueInsertRows */ + #[DataProvider('dataProviderConfigValueInsertRows')] public function testGetInsertRows(string|int $configValue, array $rowsValue): void { $GLOBALS['cfg']['InsertRows'] = $configValue; @@ -1214,9 +1214,8 @@ class InsertEditTest extends AbstractTestCase /** * Test for getSpecialCharsForInsertingMode - * - * @dataProvider providerForTestGetSpecialCharsForInsertingMode */ + #[DataProvider('providerForTestGetSpecialCharsForInsertingMode')] public function testGetSpecialCharsForInsertingMode( string|null $defaultValue, string $trueType, diff --git a/test/classes/InternalRelationsTest.php b/test/classes/InternalRelationsTest.php index 87ef4ba81a..40520bf578 100644 --- a/test/classes/InternalRelationsTest.php +++ b/test/classes/InternalRelationsTest.php @@ -5,9 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\InternalRelations; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\InternalRelations */ +#[CoversClass(InternalRelations::class)] class InternalRelationsTest extends TestCase { public function testGetInformationSchema(): void diff --git a/test/classes/IpAllowDenyTest.php b/test/classes/IpAllowDenyTest.php index 1402f971ef..0cc6e1b40d 100644 --- a/test/classes/IpAllowDenyTest.php +++ b/test/classes/IpAllowDenyTest.php @@ -6,8 +6,10 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\Core; use PhpMyAdmin\IpAllowDeny; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\IpAllowDeny */ +#[CoversClass(IpAllowDeny::class)] class IpAllowDenyTest extends AbstractTestCase { private IpAllowDeny $ipAllowDeny; @@ -38,9 +40,8 @@ class IpAllowDenyTest extends AbstractTestCase * @param string|null $header header * @param string|bool $expected expected result * @param string $proxyip proxyip - * - * @dataProvider proxyIPs */ + #[DataProvider('proxyIPs')] public function testGetIp( string|null $remote, string|null $header, diff --git a/test/classes/LanguageTest.php b/test/classes/LanguageTest.php index dac3cfe7d9..52854ba4b9 100644 --- a/test/classes/LanguageTest.php +++ b/test/classes/LanguageTest.php @@ -4,7 +4,11 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; +use PhpMyAdmin\Language; use PhpMyAdmin\LanguageManager; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use function _ngettext; use function count; @@ -12,10 +16,8 @@ use function file_exists; use function is_readable; use function strtolower; -/** - * @covers \PhpMyAdmin\Language - * @covers \PhpMyAdmin\LanguageManager - */ +#[CoversClass(Language::class)] +#[CoversClass(LanguageManager::class)] class LanguageTest extends AbstractTestCase { private LanguageManager $manager; @@ -153,9 +155,8 @@ class LanguageTest extends AbstractTestCase * @param string $agent Value for HTTP User-Agent header * @param string $default Value for default language * @param string $expect Expected language code - * - * @dataProvider selectDataProvider */ + #[DataProvider('selectDataProvider')] public function testSelect( string $lang, string $post, @@ -231,10 +232,9 @@ class LanguageTest extends AbstractTestCase * Test for setting and parsing locales * * @param string $locale locale name - * - * @group large - * @dataProvider listLocales */ + #[DataProvider('listLocales')] + #[Group('large')] public function testGettext(string $locale): void { $GLOBALS['config']->set('FilterLanguages', ''); diff --git a/test/classes/LinterTest.php b/test/classes/LinterTest.php index 0e18732817..d8745333b1 100644 --- a/test/classes/LinterTest.php +++ b/test/classes/LinterTest.php @@ -5,10 +5,12 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Linter; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function str_repeat; -/** @covers \PhpMyAdmin\Linter */ +#[CoversClass(Linter::class)] class LinterTest extends AbstractTestCase { /** @@ -71,9 +73,8 @@ class LinterTest extends AbstractTestCase * * @param mixed[] $expected The expected result. * @param string $query The query to be analyzed. - * - * @dataProvider lintProvider */ + #[DataProvider('lintProvider')] public function testLint(array $expected, string $query): void { $this->assertEquals($expected, Linter::lint($query)); diff --git a/test/classes/ListDatabaseTest.php b/test/classes/ListDatabaseTest.php index 6bf5962278..5187de0897 100644 --- a/test/classes/ListDatabaseTest.php +++ b/test/classes/ListDatabaseTest.php @@ -5,8 +5,9 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\ListDatabase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\ListDatabase */ +#[CoversClass(ListDatabase::class)] class ListDatabaseTest extends AbstractTestCase { /** diff --git a/test/classes/LoggingTest.php b/test/classes/LoggingTest.php index ade2f0e696..299ae7a4e4 100644 --- a/test/classes/LoggingTest.php +++ b/test/classes/LoggingTest.php @@ -5,8 +5,9 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Logging; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Logging */ +#[CoversClass(Logging::class)] class LoggingTest extends AbstractTestCase { public function testGetLogMessage(): void diff --git a/test/classes/MenuTest.php b/test/classes/MenuTest.php index 37e4ed61ba..1bad3bee08 100644 --- a/test/classes/MenuTest.php +++ b/test/classes/MenuTest.php @@ -7,8 +7,9 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Menu; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Menu */ +#[CoversClass(Menu::class)] class MenuTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/MessageTest.php b/test/classes/MessageTest.php index 1874c6ad62..b17cd82d3b 100644 --- a/test/classes/MessageTest.php +++ b/test/classes/MessageTest.php @@ -5,10 +5,12 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Message; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function md5; -/** @covers \PhpMyAdmin\Message */ +#[CoversClass(Message::class)] class MessageTest extends AbstractTestCase { protected Message $object; @@ -334,9 +336,8 @@ class MessageTest extends AbstractTestCase * * @param string $actual BB code string * @param string $expected Expected decoded string - * - * @dataProvider decodeBBDataProvider */ + #[DataProvider('decodeBBDataProvider')] public function testDecodeBB(string $actual, string $expected): void { unset($GLOBALS['server']); @@ -469,9 +470,8 @@ class MessageTest extends AbstractTestCase * * @param int $rows Number of rows * @param string $output Expected string - * - * @dataProvider providerAffectedRows */ + #[DataProvider('providerAffectedRows')] public function testAffectedRows(int $rows, string $output): void { $this->object = new Message(); @@ -514,9 +514,8 @@ class MessageTest extends AbstractTestCase * * @param int $rows Number of rows * @param string $output Expected string - * - * @dataProvider providerInsertedRows */ + #[DataProvider('providerInsertedRows')] public function testInsertedRows(int $rows, string $output): void { $this->object = new Message(); @@ -559,9 +558,8 @@ class MessageTest extends AbstractTestCase * * @param int $rows Number of rows * @param string $output Expected string - * - * @dataProvider providerDeletedRows */ + #[DataProvider('providerDeletedRows')] public function testDeletedRows(int $rows, string $output): void { $this->object = new Message(); diff --git a/test/classes/MimeTest.php b/test/classes/MimeTest.php index 712281553d..e5b2453204 100644 --- a/test/classes/MimeTest.php +++ b/test/classes/MimeTest.php @@ -5,10 +5,12 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Mime; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function chr; -/** @covers \PhpMyAdmin\Mime */ +#[CoversClass(Mime::class)] class MimeTest extends AbstractTestCase { /** @@ -16,9 +18,8 @@ class MimeTest extends AbstractTestCase * * @param string $test MIME to test * @param string $output Expected output - * - * @dataProvider providerForTestDetect */ + #[DataProvider('providerForTestDetect')] public function testDetect(string $test, string $output): void { $this->assertEquals( diff --git a/test/classes/Navigation/NavigationTest.php b/test/classes/Navigation/NavigationTest.php index 4a325c5f00..ea78cd3409 100644 --- a/test/classes/Navigation/NavigationTest.php +++ b/test/classes/Navigation/NavigationTest.php @@ -11,8 +11,9 @@ use PhpMyAdmin\Navigation\Navigation; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Navigation */ +#[CoversClass(Navigation::class)] class NavigationTest extends AbstractTestCase { protected Navigation $object; diff --git a/test/classes/Navigation/NavigationTreeTest.php b/test/classes/Navigation/NavigationTreeTest.php index 144288af4b..448cc3a590 100644 --- a/test/classes/Navigation/NavigationTreeTest.php +++ b/test/classes/Navigation/NavigationTreeTest.php @@ -7,8 +7,9 @@ namespace PhpMyAdmin\Tests\Navigation; use PhpMyAdmin\Navigation\NavigationTree; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\NavigationTree */ +#[CoversClass(NavigationTree::class)] class NavigationTreeTest extends AbstractTestCase { protected NavigationTree $object; diff --git a/test/classes/Navigation/NodeFactoryTest.php b/test/classes/Navigation/NodeFactoryTest.php index ab065296da..12cdd2834c 100644 --- a/test/classes/Navigation/NodeFactoryTest.php +++ b/test/classes/Navigation/NodeFactoryTest.php @@ -7,8 +7,9 @@ namespace PhpMyAdmin\Tests\Navigation; use PhpMyAdmin\Navigation\NodeFactory; use PhpMyAdmin\Navigation\Nodes\Node; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\NodeFactory */ +#[CoversClass(NodeFactory::class)] class NodeFactoryTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeColumnContainerTest.php b/test/classes/Navigation/Nodes/NodeColumnContainerTest.php index b26075a9f6..d9c36fdf79 100644 --- a/test/classes/Navigation/Nodes/NodeColumnContainerTest.php +++ b/test/classes/Navigation/Nodes/NodeColumnContainerTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeColumnContainer; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeColumnContainer */ +#[CoversClass(NodeColumnContainer::class)] class NodeColumnContainerTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeColumnTest.php b/test/classes/Navigation/Nodes/NodeColumnTest.php index eeb2cce827..1b866d49ca 100644 --- a/test/classes/Navigation/Nodes/NodeColumnTest.php +++ b/test/classes/Navigation/Nodes/NodeColumnTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeColumn; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeColumn */ +#[CoversClass(NodeColumn::class)] class NodeColumnTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeDatabaseChildTest.php b/test/classes/Navigation/Nodes/NodeDatabaseChildTest.php index a5a6137008..e644818b20 100644 --- a/test/classes/Navigation/Nodes/NodeDatabaseChildTest.php +++ b/test/classes/Navigation/Nodes/NodeDatabaseChildTest.php @@ -10,13 +10,12 @@ use PhpMyAdmin\Navigation\Nodes\NodeDatabase; use PhpMyAdmin\Navigation\Nodes\NodeDatabaseChild; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; use ReflectionClass; -/** - * @covers \PhpMyAdmin\Navigation\Nodes\NodeDatabaseChild - * @covers \PhpMyAdmin\Navigation\Nodes\NodeDatabase - */ +#[CoversClass(NodeDatabaseChild::class)] +#[CoversClass(NodeDatabase::class)] class NodeDatabaseChildTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeDatabaseTest.php b/test/classes/Navigation/Nodes/NodeDatabaseTest.php index c203bd0335..fc570f9b98 100644 --- a/test/classes/Navigation/Nodes/NodeDatabaseTest.php +++ b/test/classes/Navigation/Nodes/NodeDatabaseTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeDatabase; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeDatabase */ +#[CoversClass(NodeDatabase::class)] class NodeDatabaseTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeEventContainerTest.php b/test/classes/Navigation/Nodes/NodeEventContainerTest.php index cfd0a4f306..ed490e85e1 100644 --- a/test/classes/Navigation/Nodes/NodeEventContainerTest.php +++ b/test/classes/Navigation/Nodes/NodeEventContainerTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeEventContainer; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeEventContainer */ +#[CoversClass(NodeEventContainer::class)] class NodeEventContainerTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeEventTest.php b/test/classes/Navigation/Nodes/NodeEventTest.php index 80c3ef76f0..3c9a01ddee 100644 --- a/test/classes/Navigation/Nodes/NodeEventTest.php +++ b/test/classes/Navigation/Nodes/NodeEventTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeEvent; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeEvent */ +#[CoversClass(NodeEvent::class)] class NodeEventTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeFunctionContainerTest.php b/test/classes/Navigation/Nodes/NodeFunctionContainerTest.php index 093e1240d2..358df351ed 100644 --- a/test/classes/Navigation/Nodes/NodeFunctionContainerTest.php +++ b/test/classes/Navigation/Nodes/NodeFunctionContainerTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeFunctionContainer; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeFunctionContainer */ +#[CoversClass(NodeFunctionContainer::class)] class NodeFunctionContainerTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeFunctionTest.php b/test/classes/Navigation/Nodes/NodeFunctionTest.php index 8769525145..2b447868fa 100644 --- a/test/classes/Navigation/Nodes/NodeFunctionTest.php +++ b/test/classes/Navigation/Nodes/NodeFunctionTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeFunction; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeFunction */ +#[CoversClass(NodeFunction::class)] class NodeFunctionTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeIndexContainerTest.php b/test/classes/Navigation/Nodes/NodeIndexContainerTest.php index 56f80fb6b0..78e532506d 100644 --- a/test/classes/Navigation/Nodes/NodeIndexContainerTest.php +++ b/test/classes/Navigation/Nodes/NodeIndexContainerTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeIndexContainer; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeIndexContainer */ +#[CoversClass(NodeIndexContainer::class)] class NodeIndexContainerTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeIndexTest.php b/test/classes/Navigation/Nodes/NodeIndexTest.php index 9c258db1d6..495defb0e5 100644 --- a/test/classes/Navigation/Nodes/NodeIndexTest.php +++ b/test/classes/Navigation/Nodes/NodeIndexTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeIndex; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeIndex */ +#[CoversClass(NodeIndex::class)] class NodeIndexTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeProcedureContainerTest.php b/test/classes/Navigation/Nodes/NodeProcedureContainerTest.php index 5c9118b8f5..7cfa1937cc 100644 --- a/test/classes/Navigation/Nodes/NodeProcedureContainerTest.php +++ b/test/classes/Navigation/Nodes/NodeProcedureContainerTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeProcedureContainer; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeProcedureContainer */ +#[CoversClass(NodeProcedureContainer::class)] class NodeProcedureContainerTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeProcedureTest.php b/test/classes/Navigation/Nodes/NodeProcedureTest.php index b1d5e25dde..04e59f5c07 100644 --- a/test/classes/Navigation/Nodes/NodeProcedureTest.php +++ b/test/classes/Navigation/Nodes/NodeProcedureTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeProcedure; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeProcedure */ +#[CoversClass(NodeProcedure::class)] class NodeProcedureTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeTableContainerTest.php b/test/classes/Navigation/Nodes/NodeTableContainerTest.php index 088d43d3e4..a2c460dfb4 100644 --- a/test/classes/Navigation/Nodes/NodeTableContainerTest.php +++ b/test/classes/Navigation/Nodes/NodeTableContainerTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeTableContainer; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeTableContainer */ +#[CoversClass(NodeTableContainer::class)] class NodeTableContainerTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeTableTest.php b/test/classes/Navigation/Nodes/NodeTableTest.php index d1808b67e9..1068c007b4 100644 --- a/test/classes/Navigation/Nodes/NodeTableTest.php +++ b/test/classes/Navigation/Nodes/NodeTableTest.php @@ -6,8 +6,10 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeTable; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeTable */ +#[CoversClass(NodeTable::class)] class NodeTableTest extends AbstractTestCase { /** @@ -53,9 +55,8 @@ class NodeTableTest extends AbstractTestCase * * @param string $target target of the icon * @param string $imageName name of the image that should be set - * - * @dataProvider providerForTestIcon */ + #[DataProvider('providerForTestIcon')] public function testIcon(string $target, string $imageName, string $imageTitle): void { $GLOBALS['cfg']['NavigationTreeDefaultTabTable'] = $target; diff --git a/test/classes/Navigation/Nodes/NodeTest.php b/test/classes/Navigation/Nodes/NodeTest.php index 425d28f6f5..9ab382c7ad 100644 --- a/test/classes/Navigation/Nodes/NodeTest.php +++ b/test/classes/Navigation/Nodes/NodeTest.php @@ -8,9 +8,10 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Navigation\Nodes\Node; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionMethod; -/** @covers \PhpMyAdmin\Navigation\Nodes\Node */ +#[CoversClass(Node::class)] class NodeTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeTriggerContainerTest.php b/test/classes/Navigation/Nodes/NodeTriggerContainerTest.php index 901141828e..719f5d39dd 100644 --- a/test/classes/Navigation/Nodes/NodeTriggerContainerTest.php +++ b/test/classes/Navigation/Nodes/NodeTriggerContainerTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeTriggerContainer; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeTriggerContainer */ +#[CoversClass(NodeTriggerContainer::class)] class NodeTriggerContainerTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeTriggerTest.php b/test/classes/Navigation/Nodes/NodeTriggerTest.php index 8018c7c328..1b769500f6 100644 --- a/test/classes/Navigation/Nodes/NodeTriggerTest.php +++ b/test/classes/Navigation/Nodes/NodeTriggerTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeTrigger; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeTrigger */ +#[CoversClass(NodeTrigger::class)] class NodeTriggerTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeViewContainerTest.php b/test/classes/Navigation/Nodes/NodeViewContainerTest.php index 7f023bd429..a0c6be11d7 100644 --- a/test/classes/Navigation/Nodes/NodeViewContainerTest.php +++ b/test/classes/Navigation/Nodes/NodeViewContainerTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeViewContainer; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeViewContainer */ +#[CoversClass(NodeViewContainer::class)] class NodeViewContainerTest extends AbstractTestCase { /** diff --git a/test/classes/Navigation/Nodes/NodeViewTest.php b/test/classes/Navigation/Nodes/NodeViewTest.php index 7a60b0bef0..e554e9c5a6 100644 --- a/test/classes/Navigation/Nodes/NodeViewTest.php +++ b/test/classes/Navigation/Nodes/NodeViewTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Navigation\Nodes; use PhpMyAdmin\Navigation\Nodes\NodeView; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Navigation\Nodes\NodeView */ +#[CoversClass(NodeView::class)] class NodeViewTest extends AbstractTestCase { /** diff --git a/test/classes/NormalizationTest.php b/test/classes/NormalizationTest.php index f3830f1775..24de78685e 100644 --- a/test/classes/NormalizationTest.php +++ b/test/classes/NormalizationTest.php @@ -14,13 +14,14 @@ use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Transformations; use PhpMyAdmin\Types; +use PHPUnit\Framework\Attributes\CoversClass; use stdClass; use function __; use function _pgettext; use function json_encode; -/** @covers \PhpMyAdmin\Normalization */ +#[CoversClass(Normalization::class)] class NormalizationTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/OpenDocumentTest.php b/test/classes/OpenDocumentTest.php index c2865bd930..8ad92b7c17 100644 --- a/test/classes/OpenDocumentTest.php +++ b/test/classes/OpenDocumentTest.php @@ -7,16 +7,16 @@ namespace PhpMyAdmin\Tests; use DateTime; use PhpMyAdmin\OpenDocument; use PhpMyAdmin\ZipExtension; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use ZipArchive; use function file_put_contents; use function tempnam; use function unlink; -/** - * @covers \PhpMyAdmin\OpenDocument - * @requires extension zip - */ +#[CoversClass(OpenDocument::class)] +#[RequiresPhpExtension('zip')] class OpenDocumentTest extends AbstractTestCase { public function testCreateDocument(): void diff --git a/test/classes/OperationsTest.php b/test/classes/OperationsTest.php index cd17147b78..f47425a525 100644 --- a/test/classes/OperationsTest.php +++ b/test/classes/OperationsTest.php @@ -8,10 +8,12 @@ use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Operations; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function array_merge; -/** @covers \PhpMyAdmin\Operations */ +#[CoversClass(Operations::class)] class OperationsTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -33,11 +35,8 @@ class OperationsTest extends AbstractTestCase $this->object = new Operations($this->dbi, new Relation($this->dbi)); } - /** - * @param mixed[] $extraChoice - * - * @dataProvider providerGetPartitionMaintenanceChoices - */ + /** @param mixed[] $extraChoice */ + #[DataProvider('providerGetPartitionMaintenanceChoices')] public function testGetPartitionMaintenanceChoices(string $tableName, array $extraChoice): void { $GLOBALS['db'] = 'database'; diff --git a/test/classes/ParseAnalyzeTest.php b/test/classes/ParseAnalyzeTest.php index f078bca83f..73346852c7 100644 --- a/test/classes/ParseAnalyzeTest.php +++ b/test/classes/ParseAnalyzeTest.php @@ -7,8 +7,9 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\ParseAnalyze; use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\StatementInfo; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\ParseAnalyze */ +#[CoversClass(ParseAnalyze::class)] class ParseAnalyzeTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Partitioning/PartitionTest.php b/test/classes/Partitioning/PartitionTest.php index 2cddd79eda..9bea24d8b4 100644 --- a/test/classes/Partitioning/PartitionTest.php +++ b/test/classes/Partitioning/PartitionTest.php @@ -7,8 +7,12 @@ namespace PhpMyAdmin\Tests\Partitioning; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Partitioning\Partition; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; -/** @covers \PhpMyAdmin\Partitioning\Partition */ +#[CoversClass(Partition::class)] class PartitionTest extends AbstractTestCase { protected function setUp(): void @@ -32,13 +36,10 @@ class PartitionTest extends AbstractTestCase $this->assertEquals('RANGE', $actual); } - /** - * @param array> $pluginValue - * - * @dataProvider providerForTestHavePartitioning - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + /** @param array> $pluginValue */ + #[DataProvider('providerForTestHavePartitioning')] + #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testHavePartitioning(bool $expected, int $version, string|false $varValue, array $pluginValue): void { $mock = $this->createStub(DatabaseInterface::class); diff --git a/test/classes/Partitioning/SubPartitionTest.php b/test/classes/Partitioning/SubPartitionTest.php index be4295d008..dac3c9ad5e 100644 --- a/test/classes/Partitioning/SubPartitionTest.php +++ b/test/classes/Partitioning/SubPartitionTest.php @@ -5,9 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Partitioning; use PhpMyAdmin\Partitioning\SubPartition; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Partitioning\SubPartition */ +#[CoversClass(SubPartition::class)] class SubPartitionTest extends TestCase { public function testSubPartition(): void diff --git a/test/classes/Partitioning/TablePartitionDefinitionTest.php b/test/classes/Partitioning/TablePartitionDefinitionTest.php index 2979aa9090..24d06942ba 100644 --- a/test/classes/Partitioning/TablePartitionDefinitionTest.php +++ b/test/classes/Partitioning/TablePartitionDefinitionTest.php @@ -5,14 +5,16 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Partitioning; use PhpMyAdmin\Partitioning\TablePartitionDefinition; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function count; -/** @covers \PhpMyAdmin\Partitioning\TablePartitionDefinition */ +#[CoversClass(TablePartitionDefinition::class)] class TablePartitionDefinitionTest extends TestCase { - /** @dataProvider providerGetDetails */ + #[DataProvider('providerGetDetails')] public function testGetDetails( string $partitionBy, bool $canHaveSubpartitions, @@ -234,7 +236,7 @@ class TablePartitionDefinitionTest extends TestCase $this->assertEquals($expected, $actual); } - /** @dataProvider providerGetDetailsWithMaxPartitions */ + #[DataProvider('providerGetDetailsWithMaxPartitions')] public function testGetDetailsWithMaxPartitions(int $partitionCount, string $partitionCountFromPost): void { $_POST = ['partition_count' => $partitionCountFromPost]; diff --git a/test/classes/PdfTest.php b/test/classes/PdfTest.php index c3814e50f5..1f2494caf4 100644 --- a/test/classes/PdfTest.php +++ b/test/classes/PdfTest.php @@ -5,8 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Pdf; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; -/** @covers \PhpMyAdmin\Pdf */ +#[CoversClass(Pdf::class)] class PdfTest extends AbstractTestCase { /** @@ -21,9 +23,8 @@ class PdfTest extends AbstractTestCase /** * Test for Pdf::getPDFData - * - * @group large */ + #[Group('large')] public function testBasic(): void { $arr = new Pdf(); @@ -32,9 +33,8 @@ class PdfTest extends AbstractTestCase /** * Test for Pdf::getPDFData - * - * @group large */ + #[Group('large')] public function testAlias(): void { $arr = new Pdf(); @@ -44,9 +44,8 @@ class PdfTest extends AbstractTestCase /** * Test for Pdf::getPDFData - * - * @group large */ + #[Group('large')] public function testDocument(): void { $pdf = new Pdf(); diff --git a/test/classes/Plugins/Auth/AuthenticationConfigTest.php b/test/classes/Plugins/Auth/AuthenticationConfigTest.php index 536d3e96a2..dab16f20a3 100644 --- a/test/classes/Plugins/Auth/AuthenticationConfigTest.php +++ b/test/classes/Plugins/Auth/AuthenticationConfigTest.php @@ -10,12 +10,13 @@ use PhpMyAdmin\Exceptions\ExitException; use PhpMyAdmin\Plugins\Auth\AuthenticationConfig; use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use Throwable; use function ob_get_clean; use function ob_start; -/** @covers \PhpMyAdmin\Plugins\Auth\AuthenticationConfig */ +#[CoversClass(AuthenticationConfig::class)] class AuthenticationConfigTest extends AbstractTestCase { protected AuthenticationConfig $object; diff --git a/test/classes/Plugins/Auth/AuthenticationCookieTest.php b/test/classes/Plugins/Auth/AuthenticationCookieTest.php index f1fca19f74..885859e04b 100644 --- a/test/classes/Plugins/Auth/AuthenticationCookieTest.php +++ b/test/classes/Plugins/Auth/AuthenticationCookieTest.php @@ -11,6 +11,9 @@ use PhpMyAdmin\Header; use PhpMyAdmin\Plugins\Auth\AuthenticationCookie; use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Tests\AbstractNetworkTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use ReflectionException; use ReflectionMethod; use Throwable; @@ -29,7 +32,7 @@ use function time; use const SODIUM_CRYPTO_SECRETBOX_KEYBYTES; -/** @covers \PhpMyAdmin\Plugins\Auth\AuthenticationCookie */ +#[CoversClass(AuthenticationCookie::class)] class AuthenticationCookieTest extends AbstractNetworkTestCase { protected AuthenticationCookie $object; @@ -69,7 +72,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase unset($this->object); } - /** @group medium */ + #[Group('medium')] public function testAuthErrorAJAX(): void { $mockResponse = $this->mockResponse(); @@ -155,7 +158,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $GLOBALS['errorHandler'] = $mockErrorHandler; } - /** @group medium */ + #[Group('medium')] public function testAuthError(): void { $_REQUEST = []; @@ -231,7 +234,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $this->assertStringContainsString('', $result); } - /** @group medium */ + #[Group('medium')] public function testAuthCaptcha(): void { $mockResponse = $this->mockResponse(); @@ -309,7 +312,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase ); } - /** @group medium */ + #[Group('medium')] public function testAuthCaptchaCheckbox(): void { $mockResponse = $this->mockResponse(); @@ -744,7 +747,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase ]; } - /** @dataProvider dataProviderPasswordLength */ + #[DataProvider('dataProviderPasswordLength')] public function testAuthFailsTooLongPass(string $password, bool $trueFalse, string|null $connError): void { $_POST['pma_username'] = str_shuffle('123456987rootfoobar'); @@ -987,9 +990,8 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase * @param bool $nopass nopass * @param mixed[] $rules rules * @param string $expected expected result - * - * @dataProvider checkRulesProvider */ + #[DataProvider('checkRulesProvider')] public function testCheckRules( string $user, string $pass, diff --git a/test/classes/Plugins/Auth/AuthenticationHttpTest.php b/test/classes/Plugins/Auth/AuthenticationHttpTest.php index 18ff819e2c..e1693cd872 100644 --- a/test/classes/Plugins/Auth/AuthenticationHttpTest.php +++ b/test/classes/Plugins/Auth/AuthenticationHttpTest.php @@ -10,13 +10,17 @@ use PhpMyAdmin\Header; use PhpMyAdmin\Plugins\Auth\AuthenticationHttp; use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Tests\AbstractNetworkTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use Throwable; use function base64_encode; use function ob_get_clean; use function ob_start; -/** @covers \PhpMyAdmin\Plugins\Auth\AuthenticationHttp */ +#[CoversClass(AuthenticationHttp::class)] class AuthenticationHttpTest extends AbstractNetworkTestCase { protected AuthenticationHttp $object; @@ -162,9 +166,8 @@ class AuthenticationHttpTest extends AbstractNetworkTestCase * @param string $expectedUser expected username to be set * @param string|bool $expectedPass expected password to be set * @param string|bool $oldUsr value for $_REQUEST['old_usr'] - * - * @dataProvider readCredentialsProvider */ + #[DataProvider('readCredentialsProvider')] public function testAuthCheck( string $user, string $pass, @@ -284,10 +287,8 @@ class AuthenticationHttpTest extends AbstractNetworkTestCase $this->assertEquals(3, $GLOBALS['server']); } - /** - * @group medium - * @runInSeparateProcess - */ + #[Group('medium')] + #[RunInSeparateProcess] public function testAuthFails(): void { $GLOBALS['cfg']['Server']['host'] = ''; diff --git a/test/classes/Plugins/Auth/AuthenticationSignonTest.php b/test/classes/Plugins/Auth/AuthenticationSignonTest.php index dcab28136d..28e4a9678e 100644 --- a/test/classes/Plugins/Auth/AuthenticationSignonTest.php +++ b/test/classes/Plugins/Auth/AuthenticationSignonTest.php @@ -9,6 +9,7 @@ use PhpMyAdmin\Exceptions\ExitException; use PhpMyAdmin\Plugins\Auth\AuthenticationSignon; use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Tests\AbstractNetworkTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use Throwable; use function ob_get_clean; @@ -17,7 +18,7 @@ use function session_get_cookie_params; use function session_id; use function session_name; -/** @covers \PhpMyAdmin\Plugins\Auth\AuthenticationSignon */ +#[CoversClass(AuthenticationSignon::class)] class AuthenticationSignonTest extends AbstractNetworkTestCase { protected AuthenticationSignon $object; diff --git a/test/classes/Plugins/AuthenticationPluginFactoryTest.php b/test/classes/Plugins/AuthenticationPluginFactoryTest.php index 8f16e4f240..df8b4922e6 100644 --- a/test/classes/Plugins/AuthenticationPluginFactoryTest.php +++ b/test/classes/Plugins/AuthenticationPluginFactoryTest.php @@ -11,16 +11,17 @@ use PhpMyAdmin\Plugins\Auth\AuthenticationHttp; use PhpMyAdmin\Plugins\Auth\AuthenticationSignon; use PhpMyAdmin\Plugins\AuthenticationPluginFactory; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Plugins\AuthenticationPluginFactory */ +#[CoversClass(AuthenticationPluginFactory::class)] class AuthenticationPluginFactoryTest extends AbstractTestCase { /** * @param non-empty-string $type * @param class-string $class - * - * @dataProvider providerForTestValidPlugins */ + #[DataProvider('providerForTestValidPlugins')] public function testValidPlugins(string $type, string $class): void { $GLOBALS['cfg']['Server']['auth_type'] = $type; diff --git a/test/classes/Plugins/Export/ExportCodegenTest.php b/test/classes/Plugins/Export/ExportCodegenTest.php index 9575c869a6..9650b03326 100644 --- a/test/classes/Plugins/Export/ExportCodegenTest.php +++ b/test/classes/Plugins/Export/ExportCodegenTest.php @@ -14,6 +14,8 @@ use PhpMyAdmin\Properties\Options\Items\SelectPropertyItem; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use ReflectionMethod; use ReflectionProperty; @@ -21,10 +23,8 @@ use ReflectionProperty; use function ob_get_clean; use function ob_start; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportCodegen - * @group medium - */ +#[CoversClass(ExportCodegen::class)] +#[Group('medium')] class ExportCodegenTest extends AbstractTestCase { protected ExportCodegen $object; diff --git a/test/classes/Plugins/Export/ExportCsvTest.php b/test/classes/Plugins/Export/ExportCsvTest.php index bab799492b..0f4453d69a 100644 --- a/test/classes/Plugins/Export/ExportCsvTest.php +++ b/test/classes/Plugins/Export/ExportCsvTest.php @@ -15,16 +15,16 @@ use PhpMyAdmin\Properties\Options\Items\TextPropertyItem; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionMethod; use ReflectionProperty; use function ob_get_clean; use function ob_start; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportCsv - * @group medium - */ +#[CoversClass(ExportCsv::class)] +#[Group('medium')] class ExportCsvTest extends AbstractTestCase { protected ExportCsv $object; diff --git a/test/classes/Plugins/Export/ExportExcelTest.php b/test/classes/Plugins/Export/ExportExcelTest.php index 174455c8dc..8dd83f8494 100644 --- a/test/classes/Plugins/Export/ExportExcelTest.php +++ b/test/classes/Plugins/Export/ExportExcelTest.php @@ -16,13 +16,13 @@ use PhpMyAdmin\Properties\Options\Items\TextPropertyItem; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionMethod; use ReflectionProperty; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportExcel - * @group medium - */ +#[CoversClass(ExportExcel::class)] +#[Group('medium')] class ExportExcelTest extends AbstractTestCase { protected ExportExcel $object; diff --git a/test/classes/Plugins/Export/ExportHtmlwordTest.php b/test/classes/Plugins/Export/ExportHtmlwordTest.php index e7942ec3f8..3f0f2b2cb5 100644 --- a/test/classes/Plugins/Export/ExportHtmlwordTest.php +++ b/test/classes/Plugins/Export/ExportHtmlwordTest.php @@ -19,6 +19,8 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use ReflectionMethod; use ReflectionProperty; @@ -27,10 +29,8 @@ use function __; use function ob_get_clean; use function ob_start; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportHtmlword - * @group medium - */ +#[CoversClass(ExportHtmlword::class)] +#[Group('medium')] class ExportHtmlwordTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Plugins/Export/ExportJsonTest.php b/test/classes/Plugins/Export/ExportJsonTest.php index 8ce27d59a8..ac8b8370b3 100644 --- a/test/classes/Plugins/Export/ExportJsonTest.php +++ b/test/classes/Plugins/Export/ExportJsonTest.php @@ -14,13 +14,13 @@ use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Transformations; use PhpMyAdmin\Version; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionMethod; use ReflectionProperty; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportJson - * @group medium - */ +#[CoversClass(ExportJson::class)] +#[Group('medium')] class ExportJsonTest extends AbstractTestCase { protected ExportJson $object; diff --git a/test/classes/Plugins/Export/ExportLatexTest.php b/test/classes/Plugins/Export/ExportLatexTest.php index 9778d1c1e5..eafe3b90e2 100644 --- a/test/classes/Plugins/Export/ExportLatexTest.php +++ b/test/classes/Plugins/Export/ExportLatexTest.php @@ -18,6 +18,8 @@ use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use ReflectionMethod; @@ -25,10 +27,8 @@ use function __; use function ob_get_clean; use function ob_start; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportLatex - * @group medium - */ +#[CoversClass(ExportLatex::class)] +#[Group('medium')] class ExportLatexTest extends AbstractTestCase { protected ExportLatex $object; diff --git a/test/classes/Plugins/Export/ExportMediawikiTest.php b/test/classes/Plugins/Export/ExportMediawikiTest.php index cd66f42d8b..1ab853115b 100644 --- a/test/classes/Plugins/Export/ExportMediawikiTest.php +++ b/test/classes/Plugins/Export/ExportMediawikiTest.php @@ -16,6 +16,8 @@ use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionMethod; use ReflectionProperty; @@ -23,10 +25,8 @@ use function __; use function ob_get_clean; use function ob_start; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportMediawiki - * @group medium - */ +#[CoversClass(ExportMediawiki::class)] +#[Group('medium')] class ExportMediawikiTest extends AbstractTestCase { protected ExportMediawiki $object; diff --git a/test/classes/Plugins/Export/ExportOdsTest.php b/test/classes/Plugins/Export/ExportOdsTest.php index 324e063812..93f03ac2d2 100644 --- a/test/classes/Plugins/Export/ExportOdsTest.php +++ b/test/classes/Plugins/Export/ExportOdsTest.php @@ -19,6 +19,9 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\FieldHelper; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use ReflectionMethod; use ReflectionProperty; @@ -32,11 +35,9 @@ use const MYSQLI_TYPE_STRING; use const MYSQLI_TYPE_TIME; use const MYSQLI_TYPE_TINY_BLOB; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportOds - * @requires extension zip - * @group medium - */ +#[CoversClass(ExportOds::class)] +#[Group('medium')] +#[RequiresPhpExtension('zip')] class ExportOdsTest extends AbstractTestCase { protected ExportOds $object; diff --git a/test/classes/Plugins/Export/ExportOdtTest.php b/test/classes/Plugins/Export/ExportOdtTest.php index b9e717710c..3bdeea1689 100644 --- a/test/classes/Plugins/Export/ExportOdtTest.php +++ b/test/classes/Plugins/Export/ExportOdtTest.php @@ -21,6 +21,9 @@ use PhpMyAdmin\Tests\FieldHelper; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use ReflectionClass; use ReflectionMethod; @@ -33,11 +36,9 @@ use const MYSQLI_TYPE_BLOB; use const MYSQLI_TYPE_DECIMAL; use const MYSQLI_TYPE_STRING; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportOdt - * @requires extension zip - * @group medium - */ +#[CoversClass(ExportOdt::class)] +#[Group('medium')] +#[RequiresPhpExtension('zip')] class ExportOdtTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Plugins/Export/ExportPdfTest.php b/test/classes/Plugins/Export/ExportPdfTest.php index 13bcc4502f..f598765e3e 100644 --- a/test/classes/Plugins/Export/ExportPdfTest.php +++ b/test/classes/Plugins/Export/ExportPdfTest.php @@ -15,15 +15,15 @@ use PhpMyAdmin\Properties\Options\Items\TextPropertyItem; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionMethod; use ReflectionProperty; use function __; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportPdf - * @group medium - */ +#[CoversClass(ExportPdf::class)] +#[Group('medium')] class ExportPdfTest extends AbstractTestCase { protected ExportPdf $object; diff --git a/test/classes/Plugins/Export/ExportPhparrayTest.php b/test/classes/Plugins/Export/ExportPhparrayTest.php index 303d6b6c87..031d2934ae 100644 --- a/test/classes/Plugins/Export/ExportPhparrayTest.php +++ b/test/classes/Plugins/Export/ExportPhparrayTest.php @@ -13,16 +13,16 @@ use PhpMyAdmin\Properties\Options\Items\HiddenPropertyItem; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionMethod; use ReflectionProperty; use function ob_get_clean; use function ob_start; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportPhparray - * @group medium - */ +#[CoversClass(ExportPhparray::class)] +#[Group('medium')] class ExportPhparrayTest extends AbstractTestCase { protected ExportPhparray $object; diff --git a/test/classes/Plugins/Export/ExportSqlTest.php b/test/classes/Plugins/Export/ExportSqlTest.php index 450abcb1b8..762993610e 100644 --- a/test/classes/Plugins/Export/ExportSqlTest.php +++ b/test/classes/Plugins/Export/ExportSqlTest.php @@ -25,6 +25,8 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\FieldHelper; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use ReflectionMethod; @@ -39,10 +41,8 @@ use const MYSQLI_TYPE_LONG; use const MYSQLI_TYPE_STRING; use const MYSQLI_UNIQUE_KEY_FLAG; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportSql - * @group medium - */ +#[CoversClass(ExportSql::class)] +#[Group('medium')] class ExportSqlTest extends AbstractTestCase { protected ExportSql $object; @@ -90,7 +90,7 @@ class ExportSqlTest extends AbstractTestCase unset($this->object); } - /** @group medium */ + #[Group('medium')] public function testSetPropertiesWithHideSql(): void { // test with hide structure and hide sql as true @@ -105,7 +105,7 @@ class ExportSqlTest extends AbstractTestCase $this->assertNull($properties->getOptions()); } - /** @group medium */ + #[Group('medium')] public function testSetProperties(): void { // test with hide structure and hide sql as false @@ -752,7 +752,7 @@ class ExportSqlTest extends AbstractTestCase ); } - /** @group medium */ + #[Group('medium')] public function testGetTableDef(): void { $GLOBALS['sql_compatibility'] = 'MSSQL'; @@ -919,7 +919,7 @@ SQL; ); } - /** @group medium */ + #[Group('medium')] public function testExportStructure(): void { $GLOBALS['sql_compatibility'] = 'MSSQL'; @@ -1035,7 +1035,7 @@ SQL; $this->assertStringContainsString('CREATE TABLE `test_table`', $result); } - /** @group medium */ + #[Group('medium')] public function testExportData(): void { $dbi = $this->getMockBuilder(DatabaseInterface::class) @@ -1149,7 +1149,7 @@ SQL; $this->assertStringContainsString('SET IDENTITY_INSERT "table" OFF;', $result); } - /** @group medium */ + #[Group('medium')] public function testExportDataWithUpdate(): void { $dbi = $this->getMockBuilder(DatabaseInterface::class) diff --git a/test/classes/Plugins/Export/ExportTexytextTest.php b/test/classes/Plugins/Export/ExportTexytextTest.php index 57ce105991..ffe03800de 100644 --- a/test/classes/Plugins/Export/ExportTexytextTest.php +++ b/test/classes/Plugins/Export/ExportTexytextTest.php @@ -18,6 +18,8 @@ use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use ReflectionMethod; use ReflectionProperty; @@ -25,10 +27,8 @@ use ReflectionProperty; use function ob_get_clean; use function ob_start; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportTexytext - * @group medium - */ +#[CoversClass(ExportTexytext::class)] +#[Group('medium')] class ExportTexytextTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/Plugins/Export/ExportXmlTest.php b/test/classes/Plugins/Export/ExportXmlTest.php index 016a00ee60..5fb841bc52 100644 --- a/test/classes/Plugins/Export/ExportXmlTest.php +++ b/test/classes/Plugins/Export/ExportXmlTest.php @@ -16,16 +16,16 @@ use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Table; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionMethod; use ReflectionProperty; use function ob_get_clean; use function ob_start; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportXml - * @group medium - */ +#[CoversClass(ExportXml::class)] +#[Group('medium')] class ExportXmlTest extends AbstractTestCase { protected ExportXml $object; @@ -65,7 +65,7 @@ class ExportXmlTest extends AbstractTestCase unset($this->object); } - /** @group medium */ + #[Group('medium')] public function testSetProperties(): void { $method = new ReflectionMethod(ExportXml::class, 'setProperties'); @@ -166,7 +166,7 @@ class ExportXmlTest extends AbstractTestCase $this->assertInstanceOf(BoolPropertyItem::class, $property); } - /** @group medium */ + #[Group('medium')] public function testExportHeader(): void { $GLOBALS['xml_export_functions'] = 1; diff --git a/test/classes/Plugins/Export/ExportYamlTest.php b/test/classes/Plugins/Export/ExportYamlTest.php index 32d132732b..2055791443 100644 --- a/test/classes/Plugins/Export/ExportYamlTest.php +++ b/test/classes/Plugins/Export/ExportYamlTest.php @@ -13,16 +13,16 @@ use PhpMyAdmin\Properties\Options\Items\HiddenPropertyItem; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionMethod; use ReflectionProperty; use function ob_get_clean; use function ob_start; -/** - * @covers \PhpMyAdmin\Plugins\Export\ExportYaml - * @group medium - */ +#[CoversClass(ExportYaml::class)] +#[Group('medium')] class ExportYamlTest extends AbstractTestCase { protected ExportYaml $object; diff --git a/test/classes/Plugins/Export/Helpers/TablePropertyTest.php b/test/classes/Plugins/Export/Helpers/TablePropertyTest.php index b13546a090..6dc0394e55 100644 --- a/test/classes/Plugins/Export/Helpers/TablePropertyTest.php +++ b/test/classes/Plugins/Export/Helpers/TablePropertyTest.php @@ -6,8 +6,10 @@ namespace PhpMyAdmin\Tests\Plugins\Export\Helpers; use PhpMyAdmin\Plugins\Export\Helpers\TableProperty; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Plugins\Export\Helpers\TableProperty */ +#[CoversClass(TableProperty::class)] class TablePropertyTest extends AbstractTestCase { protected TableProperty $object; @@ -69,9 +71,8 @@ class TablePropertyTest extends AbstractTestCase /** * @param string $nullable nullable value * @param string $expected expected output - * - * @dataProvider isNotNullProvider */ + #[DataProvider('isNotNullProvider')] public function testIsNotNull(string $nullable, string $expected): void { $this->object->nullable = $nullable; @@ -95,9 +96,8 @@ class TablePropertyTest extends AbstractTestCase /** * @param string $key key value * @param string $expected expected output - * - * @dataProvider isUniqueProvider */ + #[DataProvider('isUniqueProvider')] public function testIsUnique(string $key, string $expected): void { $this->object->key = $key; @@ -121,9 +121,8 @@ class TablePropertyTest extends AbstractTestCase /** * @param string $type type value * @param string $expected expected output - * - * @dataProvider getDotNetPrimitiveTypeProvider */ + #[DataProvider('getDotNetPrimitiveTypeProvider')] public function testGetDotNetPrimitiveType(string $type, string $expected): void { $this->object->type = $type; @@ -159,9 +158,8 @@ class TablePropertyTest extends AbstractTestCase /** * @param string $type type value * @param string $expected expected output - * - * @dataProvider getDotNetObjectTypeProvider */ + #[DataProvider('getDotNetObjectTypeProvider')] public function testGetDotNetObjectType(string $type, string $expected): void { $this->object->type = $type; diff --git a/test/classes/Plugins/Import/ImportCsvTest.php b/test/classes/Plugins/Import/ImportCsvTest.php index 360de5c7cb..73dc6fe2df 100644 --- a/test/classes/Plugins/Import/ImportCsvTest.php +++ b/test/classes/Plugins/Import/ImportCsvTest.php @@ -9,11 +9,13 @@ use PhpMyAdmin\File; use PhpMyAdmin\Plugins\Import\ImportCsv; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use function __; use function basename; -/** @covers \PhpMyAdmin\Plugins\Import\ImportCsv */ +#[CoversClass(ImportCsv::class)] class ImportCsvTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -94,9 +96,8 @@ class ImportCsvTest extends AbstractTestCase /** * Test for getProperties - * - * @group medium */ + #[Group('medium')] public function testGetProperties(): void { $properties = $this->object->getProperties(); @@ -112,9 +113,8 @@ class ImportCsvTest extends AbstractTestCase /** * Test for doImport - * - * @group medium */ + #[Group('medium')] public function testDoImport(): void { //$sql_query_disabled will show the import SQL detail @@ -142,9 +142,8 @@ class ImportCsvTest extends AbstractTestCase /** * Test for partial import/setting table and database names in doImport - * - * @group medium */ + #[Group('medium')] public function testDoPartialImport(): void { //$sql_query_disabled will show the import SQL detail @@ -181,9 +180,8 @@ class ImportCsvTest extends AbstractTestCase /** * Test for getProperties for Table param - * - * @group medium */ + #[Group('medium')] public function testGetPropertiesForTable(): void { $GLOBALS['plugin_param'] = 'table'; @@ -201,9 +199,8 @@ class ImportCsvTest extends AbstractTestCase /** * Test for doImport for _getAnalyze = false, should be OK as well - * - * @group medium */ + #[Group('medium')] public function testDoImportNotAnalysis(): void { //$sql_query_disabled will show the import SQL detail @@ -232,9 +229,8 @@ class ImportCsvTest extends AbstractTestCase /** * Test for doImport in the most basic and normal way - * - * @group medium */ + #[Group('medium')] public function testDoImportNormal(): void { //$sql_query_disabled will show the import SQL detail @@ -276,9 +272,8 @@ class ImportCsvTest extends AbstractTestCase /** * Test for doImport skipping headers - * - * @group medium */ + #[Group('medium')] public function testDoImportSkipHeaders(): void { //$sql_query_disabled will show the import SQL detail diff --git a/test/classes/Plugins/Import/ImportLdiTest.php b/test/classes/Plugins/Import/ImportLdiTest.php index 21c27b969d..61d1808e3a 100644 --- a/test/classes/Plugins/Import/ImportLdiTest.php +++ b/test/classes/Plugins/Import/ImportLdiTest.php @@ -9,10 +9,12 @@ use PhpMyAdmin\File; use PhpMyAdmin\Plugins\Import\ImportLdi; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use function __; -/** @covers \PhpMyAdmin\Plugins\Import\ImportLdi */ +#[CoversClass(ImportLdi::class)] class ImportLdiTest extends AbstractTestCase { /** @@ -63,9 +65,8 @@ class ImportLdiTest extends AbstractTestCase /** * Test for getProperties - * - * @group medium */ + #[Group('medium')] public function testGetProperties(): void { $properties = (new ImportLdi())->getProperties(); @@ -81,9 +82,8 @@ class ImportLdiTest extends AbstractTestCase /** * Test for getProperties for ldi_local_option = auto - * - * @group medium */ + #[Group('medium')] public function testGetPropertiesAutoLdi(): void { $dbi = $this->createMock(DatabaseInterface::class); @@ -115,9 +115,8 @@ class ImportLdiTest extends AbstractTestCase /** * Test for doImport - * - * @group medium */ + #[Group('medium')] public function testDoImport(): void { //$sql_query_disabled will show the import SQL detail @@ -145,9 +144,8 @@ class ImportLdiTest extends AbstractTestCase /** * Test for doImport : invalid import file - * - * @group medium */ + #[Group('medium')] public function testDoImportInvalidFile(): void { $GLOBALS['import_file'] = 'none'; @@ -166,9 +164,8 @@ class ImportLdiTest extends AbstractTestCase /** * Test for doImport with LDI setting - * - * @group medium */ + #[Group('medium')] public function testDoImportLDISetting(): void { //$sql_query_disabled will show the import SQL detail diff --git a/test/classes/Plugins/Import/ImportMediawikiTest.php b/test/classes/Plugins/Import/ImportMediawikiTest.php index 473eb00548..44de9d4938 100644 --- a/test/classes/Plugins/Import/ImportMediawikiTest.php +++ b/test/classes/Plugins/Import/ImportMediawikiTest.php @@ -8,10 +8,12 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\File; use PhpMyAdmin\Plugins\Import\ImportMediawiki; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use function __; -/** @covers \PhpMyAdmin\Plugins\Import\ImportMediawiki */ +#[CoversClass(ImportMediawiki::class)] class ImportMediawikiTest extends AbstractTestCase { protected ImportMediawiki $object; @@ -66,9 +68,8 @@ class ImportMediawikiTest extends AbstractTestCase /** * Test for getProperties - * - * @group medium */ + #[Group('medium')] public function testGetProperties(): void { $properties = $this->object->getProperties(); @@ -93,9 +94,8 @@ class ImportMediawikiTest extends AbstractTestCase /** * Test for doImport - * - * @group medium */ + #[Group('medium')] public function testDoImport(): void { //$import_notice will show the import detail result diff --git a/test/classes/Plugins/Import/ImportOdsTest.php b/test/classes/Plugins/Import/ImportOdsTest.php index 0697cd1e0d..c2e9683ad0 100644 --- a/test/classes/Plugins/Import/ImportOdsTest.php +++ b/test/classes/Plugins/Import/ImportOdsTest.php @@ -9,14 +9,16 @@ use PhpMyAdmin\File; use PhpMyAdmin\Plugins\Import\ImportOds; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use function __; use function str_repeat; -/** - * @covers \PhpMyAdmin\Plugins\Import\ImportOds - * @requires extension zip - */ +#[CoversClass(ImportOds::class)] +#[RequiresPhpExtension('zip')] class ImportOdsTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -79,9 +81,8 @@ class ImportOdsTest extends AbstractTestCase /** * Test for getProperties - * - * @group medium */ + #[Group('medium')] public function testGetProperties(): void { $properties = $this->object->getProperties(); @@ -101,9 +102,8 @@ class ImportOdsTest extends AbstractTestCase /** * Test for doImport - * - * @group medium */ + #[Group('medium')] public function testDoImport(): void { //$sql_query_disabled will show the import SQL detail @@ -157,11 +157,10 @@ class ImportOdsTest extends AbstractTestCase /** * Test for doImport using second dataset - * - * @group medium - * @dataProvider dataProviderOdsEmptyRows - * @requires extension simplexml */ + #[DataProvider('dataProviderOdsEmptyRows')] + #[Group('medium')] + #[RequiresPhpExtension('simplexml')] public function testDoImportDataset2(bool $odsEmptyRowsMode): void { //$sql_query_disabled will show the import SQL detail diff --git a/test/classes/Plugins/Import/ImportShpTest.php b/test/classes/Plugins/Import/ImportShpTest.php index 6888101cf4..e274c47d29 100644 --- a/test/classes/Plugins/Import/ImportShpTest.php +++ b/test/classes/Plugins/Import/ImportShpTest.php @@ -8,14 +8,15 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\File; use PhpMyAdmin\Plugins\Import\ImportShp; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use function __; use function extension_loaded; -/** - * @covers \PhpMyAdmin\Plugins\Import\ImportShp - * @requires extension zip - */ +#[CoversClass(ImportShp::class)] +#[RequiresPhpExtension('zip')] class ImportShpTest extends AbstractTestCase { protected ImportShp $object; @@ -96,9 +97,8 @@ class ImportShpTest extends AbstractTestCase /** * Test for getProperties - * - * @group medium */ + #[Group('medium')] public function testGetProperties(): void { $properties = $this->object->getProperties(); @@ -119,10 +119,9 @@ class ImportShpTest extends AbstractTestCase /** * Test for doImport with complex data - * - * @group medium - * @group 32bit-incompatible */ + #[Group('medium')] + #[Group('32bit-incompatible')] public function testImportOsm(): void { //$sql_query_disabled will show the import SQL detail @@ -155,10 +154,9 @@ class ImportShpTest extends AbstractTestCase /** * Test for doImport - * - * @group medium - * @group 32bit-incompatible */ + #[Group('medium')] + #[Group('32bit-incompatible')] public function testDoImport(): void { //$sql_query_disabled will show the import SQL detail diff --git a/test/classes/Plugins/Import/ImportSqlTest.php b/test/classes/Plugins/Import/ImportSqlTest.php index b475cf9a59..03471a55f6 100644 --- a/test/classes/Plugins/Import/ImportSqlTest.php +++ b/test/classes/Plugins/Import/ImportSqlTest.php @@ -8,8 +8,10 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\File; use PhpMyAdmin\Plugins\Import\ImportSql; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; -/** @covers \PhpMyAdmin\Plugins\Import\ImportSql */ +#[CoversClass(ImportSql::class)] class ImportSqlTest extends AbstractTestCase { protected ImportSql $object; @@ -63,9 +65,8 @@ class ImportSqlTest extends AbstractTestCase /** * Test for doImport - * - * @group medium */ + #[Group('medium')] public function testDoImport(): void { //$sql_query_disabled will show the import SQL detail diff --git a/test/classes/Plugins/Import/ImportXmlTest.php b/test/classes/Plugins/Import/ImportXmlTest.php index 8107a0fd7e..a89746e99f 100644 --- a/test/classes/Plugins/Import/ImportXmlTest.php +++ b/test/classes/Plugins/Import/ImportXmlTest.php @@ -8,14 +8,15 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\File; use PhpMyAdmin\Plugins\Import\ImportXml; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use function __; -/** - * @covers \PhpMyAdmin\Plugins\Import\ImportXml - * @requires extension xml - * @requires extension xmlwriter - */ +#[CoversClass(ImportXml::class)] +#[RequiresPhpExtension('xml')] +#[RequiresPhpExtension('xmlwriter')] class ImportXmlTest extends AbstractTestCase { protected ImportXml $object; @@ -71,9 +72,8 @@ class ImportXmlTest extends AbstractTestCase /** * Test for getProperties - * - * @group medium */ + #[Group('medium')] public function testGetProperties(): void { $properties = $this->object->getProperties(); @@ -98,10 +98,9 @@ class ImportXmlTest extends AbstractTestCase /** * Test for doImport - * - * @group medium - * @requires extension simplexml */ + #[Group('medium')] + #[RequiresPhpExtension('simplexml')] public function testDoImport(): void { //$import_notice will show the import detail result diff --git a/test/classes/Plugins/Schema/DiaRelationSchemaTest.php b/test/classes/Plugins/Schema/DiaRelationSchemaTest.php index 73e836e3b7..bf22d550f2 100644 --- a/test/classes/Plugins/Schema/DiaRelationSchemaTest.php +++ b/test/classes/Plugins/Schema/DiaRelationSchemaTest.php @@ -7,11 +7,12 @@ namespace PhpMyAdmin\Tests\Plugins\Schema; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Plugins\Schema\Dia\DiaRelationSchema; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; -/** - * @covers \PhpMyAdmin\Plugins\Schema\Dia\DiaRelationSchema - * @requires extension xmlwriter - */ +#[CoversClass(DiaRelationSchema::class)] +#[RequiresPhpExtension('xmlwriter')] class DiaRelationSchemaTest extends AbstractTestCase { protected DiaRelationSchema $object; @@ -57,9 +58,8 @@ class DiaRelationSchemaTest extends AbstractTestCase /** * Test for construct, the Property is set correctly - * - * @group medium */ + #[Group('medium')] public function testSetProperty(): void { $this->assertEquals(33, $this->object->getPageNumber()); diff --git a/test/classes/Plugins/Schema/EpsRelationSchemaTest.php b/test/classes/Plugins/Schema/EpsRelationSchemaTest.php index 1b253ce165..752b61c985 100644 --- a/test/classes/Plugins/Schema/EpsRelationSchemaTest.php +++ b/test/classes/Plugins/Schema/EpsRelationSchemaTest.php @@ -7,8 +7,10 @@ namespace PhpMyAdmin\Tests\Plugins\Schema; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Plugins\Schema\Eps\EpsRelationSchema; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; -/** @covers \PhpMyAdmin\Plugins\Schema\Eps\EpsRelationSchema */ +#[CoversClass(EpsRelationSchema::class)] class EpsRelationSchemaTest extends AbstractTestCase { protected EpsRelationSchema $object; @@ -55,9 +57,8 @@ class EpsRelationSchemaTest extends AbstractTestCase /** * Test for construct - * - * @group medium */ + #[Group('medium')] public function testConstructor(): void { $this->assertEquals(33, $this->object->getPageNumber()); @@ -70,9 +71,8 @@ class EpsRelationSchemaTest extends AbstractTestCase /** * Test for setPageNumber - * - * @group medium */ + #[Group('medium')] public function testSetPageNumber(): void { $this->object->setPageNumber(33); diff --git a/test/classes/Plugins/Schema/ExportRelationSchemaTest.php b/test/classes/Plugins/Schema/ExportRelationSchemaTest.php index efa7b93ccd..ab9c069c2f 100644 --- a/test/classes/Plugins/Schema/ExportRelationSchemaTest.php +++ b/test/classes/Plugins/Schema/ExportRelationSchemaTest.php @@ -7,8 +7,10 @@ namespace PhpMyAdmin\Tests\Plugins\Schema; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Plugins\Schema\ExportRelationSchema; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; -/** @covers \PhpMyAdmin\Plugins\Schema\ExportRelationSchema */ +#[CoversClass(ExportRelationSchema::class)] class ExportRelationSchemaTest extends AbstractTestCase { /** @var ExportRelationSchema */ @@ -40,9 +42,8 @@ class ExportRelationSchemaTest extends AbstractTestCase /** * Test for setPageNumber - * - * @group medium */ + #[Group('medium')] public function testSetPageNumber(): void { $this->object->setPageNumber(33); @@ -54,9 +55,8 @@ class ExportRelationSchemaTest extends AbstractTestCase /** * Test for setShowColor - * - * @group medium */ + #[Group('medium')] public function testSetShowColor(): void { $this->object->setShowColor(true); @@ -71,9 +71,8 @@ class ExportRelationSchemaTest extends AbstractTestCase /** * Test for setOrientation - * - * @group medium */ + #[Group('medium')] public function testSetOrientation(): void { $this->object->setOrientation('P'); @@ -90,9 +89,8 @@ class ExportRelationSchemaTest extends AbstractTestCase /** * Test for setTableDimension - * - * @group medium */ + #[Group('medium')] public function testSetTableDimension(): void { $this->object->setTableDimension(true); @@ -107,9 +105,8 @@ class ExportRelationSchemaTest extends AbstractTestCase /** * Test for setPaper - * - * @group medium */ + #[Group('medium')] public function testSetPaper(): void { $this->object->setPaper('A5'); @@ -126,9 +123,8 @@ class ExportRelationSchemaTest extends AbstractTestCase /** * Test for setAllTablesSameWidth - * - * @group medium */ + #[Group('medium')] public function testSetAllTablesSameWidth(): void { $this->object->setAllTablesSameWidth(true); @@ -143,9 +139,8 @@ class ExportRelationSchemaTest extends AbstractTestCase /** * Test for setShowKeys - * - * @group medium */ + #[Group('medium')] public function testSetShowKeys(): void { $this->object->setShowKeys(true); diff --git a/test/classes/Plugins/Schema/PdfRelationSchemaTest.php b/test/classes/Plugins/Schema/PdfRelationSchemaTest.php index 3ffe771257..9590becb48 100644 --- a/test/classes/Plugins/Schema/PdfRelationSchemaTest.php +++ b/test/classes/Plugins/Schema/PdfRelationSchemaTest.php @@ -7,8 +7,10 @@ namespace PhpMyAdmin\Tests\Plugins\Schema; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Plugins\Schema\Pdf\PdfRelationSchema; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; -/** @covers \PhpMyAdmin\Plugins\Schema\Pdf\PdfRelationSchema */ +#[CoversClass(PdfRelationSchema::class)] class PdfRelationSchemaTest extends AbstractTestCase { protected PdfRelationSchema $object; @@ -58,9 +60,8 @@ class PdfRelationSchemaTest extends AbstractTestCase /** * Test for construct - * - * @group large */ + #[Group('large')] public function testConstructor(): void { $this->assertEquals(33, $this->object->getPageNumber()); diff --git a/test/classes/Plugins/Schema/SvgRelationSchemaTest.php b/test/classes/Plugins/Schema/SvgRelationSchemaTest.php index 23dc55f354..e6a6c6e5f3 100644 --- a/test/classes/Plugins/Schema/SvgRelationSchemaTest.php +++ b/test/classes/Plugins/Schema/SvgRelationSchemaTest.php @@ -7,11 +7,12 @@ namespace PhpMyAdmin\Tests\Plugins\Schema; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Plugins\Schema\Svg\SvgRelationSchema; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; -/** - * @covers \PhpMyAdmin\Plugins\Schema\Svg\SvgRelationSchema - * @requires extension xmlwriter - */ +#[CoversClass(SvgRelationSchema::class)] +#[RequiresPhpExtension('xmlwriter')] class SvgRelationSchemaTest extends AbstractTestCase { protected SvgRelationSchema $object; @@ -60,9 +61,8 @@ class SvgRelationSchemaTest extends AbstractTestCase /** * Test for construct - * - * @group medium */ + #[Group('medium')] public function testConstructor(): void { $this->assertEquals(33, $this->object->getPageNumber()); diff --git a/test/classes/Plugins/Transformations/TransformationPluginsTest.php b/test/classes/Plugins/Transformations/TransformationPluginsTest.php index 26c8d3daf2..0fe3970524 100644 --- a/test/classes/Plugins/Transformations/TransformationPluginsTest.php +++ b/test/classes/Plugins/Transformations/TransformationPluginsTest.php @@ -26,6 +26,9 @@ use PhpMyAdmin\Plugins\Transformations\Text_Plain_Substring; use PhpMyAdmin\Plugins\TransformationsPlugin; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\FieldHelper; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use ReflectionMethod; use function date_default_timezone_set; @@ -37,9 +40,8 @@ use const MYSQLI_TYPE_TINY; /** * Tests for different input/output transformation plugins - * - * @coversNothing */ +#[CoversNothing] class TransformationPluginsTest extends AbstractTestCase { /** @@ -354,10 +356,9 @@ class TransformationPluginsTest extends AbstractTestCase * @param string $method the method name * @param mixed $expected the expected output * @param mixed[] $args the array of arguments - * - * @dataProvider multiDataProvider - * @group medium */ + #[DataProvider('multiDataProvider')] + #[Group('medium')] public function testGetMulti(object $object, string $method, mixed $expected, array $args = []): void { if (! method_exists($object, $method)) { @@ -604,10 +605,9 @@ class TransformationPluginsTest extends AbstractTestCase * @param bool $success the expected output of isSuccess * @param string $error the expected output of getError * @psalm-param array{string, array, FieldMetadata|null} $applyArgs - * - * @dataProvider transformationDataProvider - * @group medium */ + #[DataProvider('transformationDataProvider')] + #[Group('medium')] public function testTransformation( TransformationsPlugin $object, array $applyArgs, diff --git a/test/classes/Plugins/TwoFactor/KeyTest.php b/test/classes/Plugins/TwoFactor/KeyTest.php index e59aba073d..593cf7a788 100644 --- a/test/classes/Plugins/TwoFactor/KeyTest.php +++ b/test/classes/Plugins/TwoFactor/KeyTest.php @@ -7,8 +7,9 @@ namespace PhpMyAdmin\Tests\Plugins\TwoFactor; use PhpMyAdmin\Plugins\TwoFactor\Key; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\TwoFactor; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Plugins\TwoFactor\Key */ +#[CoversClass(Key::class)] class KeyTest extends AbstractTestCase { public function testGetRegistrations(): void diff --git a/test/classes/Plugins/TwoFactor/WebAuthnTest.php b/test/classes/Plugins/TwoFactor/WebAuthnTest.php index 28b6e683a8..195771cd23 100644 --- a/test/classes/Plugins/TwoFactor/WebAuthnTest.php +++ b/test/classes/Plugins/TwoFactor/WebAuthnTest.php @@ -6,21 +6,21 @@ namespace PhpMyAdmin\Tests\Plugins\TwoFactor; use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Plugins\TwoFactor\WebAuthn; +use PhpMyAdmin\Plugins\TwoFactorPlugin; use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\TwoFactor; use PhpMyAdmin\WebAuthn\Server; use PhpMyAdmin\WebAuthn\WebAuthnException; +use PHPUnit\Framework\Attributes\CoversClass; use Psr\Http\Message\UriInterface; use function array_column; use function json_decode; -/** - * @covers \PhpMyAdmin\Plugins\TwoFactor\WebAuthn - * @covers \PhpMyAdmin\Plugins\TwoFactorPlugin - * @covers \PhpMyAdmin\WebAuthn\WebAuthnException - */ +#[CoversClass(WebAuthn::class)] +#[CoversClass(TwoFactorPlugin::class)] +#[CoversClass(WebAuthnException::class)] class WebAuthnTest extends AbstractTestCase { public function testIdNameAndDescription(): void diff --git a/test/classes/PluginsTest.php b/test/classes/PluginsTest.php index ba9a1c6576..f05f98570c 100644 --- a/test/classes/PluginsTest.php +++ b/test/classes/PluginsTest.php @@ -8,8 +8,10 @@ use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Export; use PhpMyAdmin\Plugins; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Plugins */ +#[CoversClass(Plugins::class)] class PluginsTest extends AbstractTestCase { protected function setUp(): void @@ -49,11 +51,8 @@ class PluginsTest extends AbstractTestCase $this->assertContainsOnlyInstancesOf(Plugins\SchemaPlugin::class, $plugins); } - /** - * @psalm-param 'Export'|'Import'|'Schema' $section - * - * @dataProvider providerForTestGetDefault - */ + /** @psalm-param 'Export'|'Import'|'Schema' $section */ + #[DataProvider('providerForTestGetDefault')] public function testGetDefault( string $expected, string|int|null $actualConfig, diff --git a/test/classes/ProfilingTest.php b/test/classes/ProfilingTest.php index ce24063444..4e0d502706 100644 --- a/test/classes/ProfilingTest.php +++ b/test/classes/ProfilingTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\Profiling; use PhpMyAdmin\Utils\SessionCache; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Profiling */ +#[CoversClass(Profiling::class)] class ProfilingTest extends AbstractTestCase { public function testIsSupported(): void diff --git a/test/classes/Properties/Options/Groups/OptionsPropertyMainGroupTest.php b/test/classes/Properties/Options/Groups/OptionsPropertyMainGroupTest.php index 1f478718f6..de8c0eb17f 100644 --- a/test/classes/Properties/Options/Groups/OptionsPropertyMainGroupTest.php +++ b/test/classes/Properties/Options/Groups/OptionsPropertyMainGroupTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Properties\Options\Groups; use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup */ +#[CoversClass(OptionsPropertyMainGroup::class)] class OptionsPropertyMainGroupTest extends AbstractTestCase { protected OptionsPropertyMainGroup $object; diff --git a/test/classes/Properties/Options/Groups/OptionsPropertyRootGroupTest.php b/test/classes/Properties/Options/Groups/OptionsPropertyRootGroupTest.php index 84764261fb..99bbacaecd 100644 --- a/test/classes/Properties/Options/Groups/OptionsPropertyRootGroupTest.php +++ b/test/classes/Properties/Options/Groups/OptionsPropertyRootGroupTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Properties\Options\Groups; use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyRootGroup; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Properties\Options\Groups\OptionsPropertyRootGroup */ +#[CoversClass(OptionsPropertyRootGroup::class)] class OptionsPropertyRootGroupTest extends AbstractTestCase { protected OptionsPropertyRootGroup $object; diff --git a/test/classes/Properties/Options/Groups/OptionsPropertySubgroupTest.php b/test/classes/Properties/Options/Groups/OptionsPropertySubgroupTest.php index 5e69a09bbd..6163c206d4 100644 --- a/test/classes/Properties/Options/Groups/OptionsPropertySubgroupTest.php +++ b/test/classes/Properties/Options/Groups/OptionsPropertySubgroupTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Properties\Options\Groups; use PhpMyAdmin\Properties\Options\Groups\OptionsPropertySubgroup; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Properties\Options\Groups\OptionsPropertySubgroup */ +#[CoversClass(OptionsPropertySubgroup::class)] class OptionsPropertySubgroupTest extends AbstractTestCase { protected OptionsPropertySubgroup $object; diff --git a/test/classes/Properties/Options/Items/PropertyItemsTest.php b/test/classes/Properties/Options/Items/PropertyItemsTest.php index 1fc0c98c06..49e42d2f24 100644 --- a/test/classes/Properties/Options/Items/PropertyItemsTest.php +++ b/test/classes/Properties/Options/Items/PropertyItemsTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem; use PhpMyAdmin\Properties\Options\Items\SelectPropertyItem; use PhpMyAdmin\Properties\Options\Items\TextPropertyItem; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversNothing; -/** @coversNothing */ +#[CoversNothing] class PropertyItemsTest extends AbstractTestCase { public function testBoolText(): void diff --git a/test/classes/Properties/Options/OptionsPropertyGroupTest.php b/test/classes/Properties/Options/OptionsPropertyGroupTest.php index 16733d1da5..152c4542ce 100644 --- a/test/classes/Properties/Options/OptionsPropertyGroupTest.php +++ b/test/classes/Properties/Options/OptionsPropertyGroupTest.php @@ -7,9 +7,10 @@ namespace PhpMyAdmin\Tests\Properties\Options; use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem; use PhpMyAdmin\Properties\Options\OptionsPropertyGroup; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; -/** @covers \PhpMyAdmin\Properties\Options\OptionsPropertyGroup */ +#[CoversClass(OptionsPropertyGroup::class)] class OptionsPropertyGroupTest extends AbstractTestCase { /** @var OptionsPropertyGroup&MockObject */ diff --git a/test/classes/Properties/Options/OptionsPropertyItemTest.php b/test/classes/Properties/Options/OptionsPropertyItemTest.php index ef92ab1133..6cc1182cf3 100644 --- a/test/classes/Properties/Options/OptionsPropertyItemTest.php +++ b/test/classes/Properties/Options/OptionsPropertyItemTest.php @@ -6,9 +6,10 @@ namespace PhpMyAdmin\Tests\Properties\Options; use PhpMyAdmin\Properties\Options\OptionsPropertyItem; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; -/** @covers \PhpMyAdmin\Properties\Options\OptionsPropertyItem */ +#[CoversClass(OptionsPropertyItem::class)] class OptionsPropertyItemTest extends AbstractTestCase { /** @var OptionsPropertyItem&MockObject */ diff --git a/test/classes/Properties/Options/OptionsPropertyOneItemTest.php b/test/classes/Properties/Options/OptionsPropertyOneItemTest.php index ed3ee6cd0c..1f06c0607e 100644 --- a/test/classes/Properties/Options/OptionsPropertyOneItemTest.php +++ b/test/classes/Properties/Options/OptionsPropertyOneItemTest.php @@ -6,9 +6,10 @@ namespace PhpMyAdmin\Tests\Properties\Options; use PhpMyAdmin\Properties\Options\OptionsPropertyOneItem; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; -/** @covers \PhpMyAdmin\Properties\Options\OptionsPropertyOneItem */ +#[CoversClass(OptionsPropertyOneItem::class)] class OptionsPropertyOneItemTest extends AbstractTestCase { /** @var OptionsPropertyOneItem&MockObject */ diff --git a/test/classes/Properties/Plugins/ExportPluginPropertiesTest.php b/test/classes/Properties/Plugins/ExportPluginPropertiesTest.php index 81db3550b8..dbfc93837a 100644 --- a/test/classes/Properties/Plugins/ExportPluginPropertiesTest.php +++ b/test/classes/Properties/Plugins/ExportPluginPropertiesTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Properties\Plugins; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Properties\Plugins\ExportPluginProperties */ +#[CoversClass(ExportPluginProperties::class)] class ExportPluginPropertiesTest extends AbstractTestCase { protected ExportPluginProperties $object; diff --git a/test/classes/Properties/Plugins/ImportPluginPropertiesTest.php b/test/classes/Properties/Plugins/ImportPluginPropertiesTest.php index 35c07a4b22..ac671c223f 100644 --- a/test/classes/Properties/Plugins/ImportPluginPropertiesTest.php +++ b/test/classes/Properties/Plugins/ImportPluginPropertiesTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Properties\Plugins; use PhpMyAdmin\Properties\Plugins\ImportPluginProperties; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Properties\Plugins\ImportPluginProperties */ +#[CoversClass(ImportPluginProperties::class)] class ImportPluginPropertiesTest extends AbstractTestCase { protected ImportPluginProperties $object; diff --git a/test/classes/Properties/Plugins/PluginPropertyItemTest.php b/test/classes/Properties/Plugins/PluginPropertyItemTest.php index ec6a6df7b8..d471da2c1c 100644 --- a/test/classes/Properties/Plugins/PluginPropertyItemTest.php +++ b/test/classes/Properties/Plugins/PluginPropertyItemTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Properties\Plugins; use PhpMyAdmin\Properties\Plugins\PluginPropertyItem; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Properties\Plugins\PluginPropertyItem */ +#[CoversClass(PluginPropertyItem::class)] class PluginPropertyItemTest extends AbstractTestCase { protected PluginPropertyItem $stub; diff --git a/test/classes/Properties/PropertyItemTest.php b/test/classes/Properties/PropertyItemTest.php index 4874a7af15..8d09ba959b 100644 --- a/test/classes/Properties/PropertyItemTest.php +++ b/test/classes/Properties/PropertyItemTest.php @@ -6,9 +6,10 @@ namespace PhpMyAdmin\Tests\Properties; use PhpMyAdmin\Properties\PropertyItem; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; -/** @covers \PhpMyAdmin\Properties\PropertyItem */ +#[CoversClass(PropertyItem::class)] class PropertyItemTest extends AbstractTestCase { /** @var PropertyItem&MockObject */ diff --git a/test/classes/Query/CompatibilityTest.php b/test/classes/Query/CompatibilityTest.php index 7bdcdf4fab..ec7e840c85 100644 --- a/test/classes/Query/CompatibilityTest.php +++ b/test/classes/Query/CompatibilityTest.php @@ -6,12 +6,14 @@ namespace PhpMyAdmin\Tests\Query; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Query\Compatibility; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Query\Compatibility */ +#[CoversClass(Compatibility::class)] class CompatibilityTest extends TestCase { - /** @dataProvider providerForTestHasAccountLocking */ + #[DataProvider('providerForTestHasAccountLocking')] public function testHasAccountLocking(bool $expected, bool $isMariaDb, int $version): void { $this->assertSame($expected, Compatibility::hasAccountLocking($isMariaDb, $version)); @@ -33,7 +35,7 @@ class CompatibilityTest extends TestCase ]; } - /** @dataProvider providerForTestIsUUIDSupported */ + #[DataProvider('providerForTestIsUUIDSupported')] public function testIsUUIDSupported(bool $expected, bool $isMariaDb, int $version): void { $dbiStub = $this->createStub(DatabaseInterface::class); diff --git a/test/classes/Query/GeneratorTest.php b/test/classes/Query/GeneratorTest.php index 0f054bd11f..ffd4d1c12d 100644 --- a/test/classes/Query/GeneratorTest.php +++ b/test/classes/Query/GeneratorTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Query; use PhpMyAdmin\Query\Generator; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Query\Generator */ +#[CoversClass(Generator::class)] class GeneratorTest extends AbstractTestCase { public function testGetColumnsSql(): void diff --git a/test/classes/Replication/ReplicationGuiTest.php b/test/classes/Replication/ReplicationGuiTest.php index 00e48a0919..f2f2ec0b1c 100644 --- a/test/classes/Replication/ReplicationGuiTest.php +++ b/test/classes/Replication/ReplicationGuiTest.php @@ -9,8 +9,10 @@ use PhpMyAdmin\Replication\ReplicationGui; use PhpMyAdmin\Replication\ReplicationInfo; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; -/** @covers \PhpMyAdmin\Replication\ReplicationGui */ +#[CoversClass(ReplicationGui::class)] class ReplicationGuiTest extends AbstractTestCase { /** @@ -48,7 +50,7 @@ class ReplicationGuiTest extends AbstractTestCase $this->replicationGui = new ReplicationGui(new Replication($GLOBALS['dbi']), new Template()); } - /** @group medium */ + #[Group('medium')] public function testGetHtmlForPrimaryReplication(): void { $html = $this->replicationGui->getHtmlForPrimaryReplication(null, false, 'primary_add_user', null, null); diff --git a/test/classes/ResponseRendererTest.php b/test/classes/ResponseRendererTest.php index 5558a0e624..5e06c5dbb5 100644 --- a/test/classes/ResponseRendererTest.php +++ b/test/classes/ResponseRendererTest.php @@ -7,11 +7,12 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\Footer; use PhpMyAdmin\Header; use PhpMyAdmin\ResponseRenderer; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\PreserveGlobalState; use PHPUnit\Framework\Attributes\RunInSeparateProcess; use ReflectionProperty; -/** @covers \PhpMyAdmin\ResponseRenderer */ +#[CoversClass(ResponseRenderer::class)] class ResponseRendererTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/RoutingTest.php b/test/classes/RoutingTest.php index 47273356b7..253c993492 100644 --- a/test/classes/RoutingTest.php +++ b/test/classes/RoutingTest.php @@ -7,6 +7,8 @@ namespace PhpMyAdmin\Tests; use FastRoute\Dispatcher; use PhpMyAdmin\Controllers\HomeController; use PhpMyAdmin\Routing; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function copy; use function unlink; @@ -14,7 +16,7 @@ use function unlink; use const CACHE_DIR; use const TEST_PATH; -/** @covers \PhpMyAdmin\Routing */ +#[CoversClass(Routing::class)] class RoutingTest extends AbstractTestCase { /** @@ -66,9 +68,8 @@ class RoutingTest extends AbstractTestCase * @param string $request The REQUEST_URI value * @param string $pathInfo The PATH_INFO value * @param string $expected Expected result - * - * @dataProvider providerForTestCleanupPathInfo */ + #[DataProvider('providerForTestCleanupPathInfo')] public function testCleanupPathInfo(string $phpSelf, string $request, string $pathInfo, string $expected): void { $_SERVER['PHP_SELF'] = $phpSelf; diff --git a/test/classes/SanitizeTest.php b/test/classes/SanitizeTest.php index 2da686a6f3..be782d3bdf 100644 --- a/test/classes/SanitizeTest.php +++ b/test/classes/SanitizeTest.php @@ -5,8 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Sanitize; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Sanitize */ +#[CoversClass(Sanitize::class)] class SanitizeTest extends AbstractTestCase { /** @@ -53,9 +55,8 @@ class SanitizeTest extends AbstractTestCase * * @param string $link link * @param string $expected expected result - * - * @dataProvider docLinks */ + #[DataProvider('docLinks')] public function testDoc(string $link, string $expected): void { $this->assertEquals( @@ -166,9 +167,8 @@ class SanitizeTest extends AbstractTestCase * @param string $key Key * @param string|bool|int|string[] $value Value * @param string $expected Expected output - * - * @dataProvider variables */ + #[DataProvider('variables')] public function testGetJsValue(string $key, string|bool|int|array $value, string $expected): void { $this->assertEquals($expected, Sanitize::getJsValue($key, $value)); @@ -243,9 +243,8 @@ class SanitizeTest extends AbstractTestCase /** * Tests link sanitize - * - * @dataProvider dataProviderCheckLinks */ + #[DataProvider('dataProviderCheckLinks')] public function testCheckLink(bool $expected, string $url, bool $http, bool $other): void { $this->assertSame( diff --git a/test/classes/ScriptsTest.php b/test/classes/ScriptsTest.php index b766529fc2..2b8fc4a29c 100644 --- a/test/classes/ScriptsTest.php +++ b/test/classes/ScriptsTest.php @@ -6,11 +6,12 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\Scripts; use PhpMyAdmin\Version; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionProperty; use function rawurlencode; -/** @covers \PhpMyAdmin\Scripts */ +#[CoversClass(Scripts::class)] class ScriptsTest extends AbstractTestCase { protected Scripts $object; diff --git a/test/classes/Server/PluginTest.php b/test/classes/Server/PluginTest.php index 9d48630ee8..eac80709ac 100644 --- a/test/classes/Server/PluginTest.php +++ b/test/classes/Server/PluginTest.php @@ -6,8 +6,10 @@ namespace PhpMyAdmin\Tests\Server; use PhpMyAdmin\Server\Plugin; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Depends; -/** @covers \PhpMyAdmin\Server\Plugin */ +#[CoversClass(Plugin::class)] class PluginTest extends AbstractTestCase { public function testFromState(): Plugin @@ -49,7 +51,7 @@ class PluginTest extends AbstractTestCase return $plugin; } - /** @depends testFromState */ + #[Depends('testFromState')] public function testToArray(Plugin $plugin): void { $this->assertSame([ diff --git a/test/classes/Server/PluginsTest.php b/test/classes/Server/PluginsTest.php index f39c5df821..05c034ed2b 100644 --- a/test/classes/Server/PluginsTest.php +++ b/test/classes/Server/PluginsTest.php @@ -7,10 +7,11 @@ namespace PhpMyAdmin\Tests\Server; use PhpMyAdmin\Server\Plugin; use PhpMyAdmin\Server\Plugins; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use function __; -/** @covers \PhpMyAdmin\Server\Plugins */ +#[CoversClass(Plugins::class)] class PluginsTest extends AbstractTestCase { private Plugins $plugins; diff --git a/test/classes/Server/Privileges/AccountLockingTest.php b/test/classes/Server/Privileges/AccountLockingTest.php index bccbbc3100..b433c4a1c6 100644 --- a/test/classes/Server/Privileges/AccountLockingTest.php +++ b/test/classes/Server/Privileges/AccountLockingTest.php @@ -7,10 +7,11 @@ namespace PhpMyAdmin\Tests\Server\Privileges; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Server\Privileges\AccountLocking; use PhpMyAdmin\Tests\Stubs\DummyResult; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Throwable; -/** @covers \PhpMyAdmin\Server\Privileges\AccountLocking */ +#[CoversClass(AccountLocking::class)] class AccountLockingTest extends TestCase { public function testLockWithValidAccount(): void diff --git a/test/classes/Server/PrivilegesTest.php b/test/classes/Server/PrivilegesTest.php index 636277c618..034aad33ef 100644 --- a/test/classes/Server/PrivilegesTest.php +++ b/test/classes/Server/PrivilegesTest.php @@ -21,6 +21,9 @@ use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Url; use PhpMyAdmin\Util; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use ReflectionMethod; @@ -29,7 +32,7 @@ use function _pgettext; use function htmlspecialchars; use function implode; -/** @covers \PhpMyAdmin\Server\Privileges */ +#[CoversClass(Privileges::class)] class PrivilegesTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -553,7 +556,7 @@ class PrivilegesTest extends AbstractTestCase ); } - /** @group medium */ + #[Group('medium')] public function testGetHtmlToDisplayPrivilegesTable(): void { $GLOBALS['hostname'] = 'hostname'; @@ -884,7 +887,7 @@ class PrivilegesTest extends AbstractTestCase $this->assertStringContainsString($expect, $sqlQuery); } - /** @group medium */ + #[Group('medium')] public function testGetHtmlForAddUser(): void { $dbi = $this->createDatabaseInterface(); @@ -1876,9 +1879,8 @@ class PrivilegesTest extends AbstractTestCase /** * @param string $a Expected value * @param string $b String to escape - * - * @dataProvider providerUnEscapeMysqlWildcards */ + #[DataProvider('providerUnEscapeMysqlWildcards')] public function testEscapeMysqlWildcards(string $a, string $b): void { $dbi = $this->createDatabaseInterface(); @@ -1892,9 +1894,8 @@ class PrivilegesTest extends AbstractTestCase /** * @param string $a String to unescape * @param string $b Expected value - * - * @dataProvider providerUnEscapeMysqlWildcards */ + #[DataProvider('providerUnEscapeMysqlWildcards')] public function testUnescapeMysqlWildcards(string $a, string $b): void { $dbi = $this->createDatabaseInterface(); diff --git a/test/classes/Server/SelectTest.php b/test/classes/Server/SelectTest.php index 67d1c7ca48..98535916ba 100644 --- a/test/classes/Server/SelectTest.php +++ b/test/classes/Server/SelectTest.php @@ -7,10 +7,12 @@ namespace PhpMyAdmin\Tests\Server; use PhpMyAdmin\Server\Select; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Util; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function __; -/** @covers \PhpMyAdmin\Server\Select */ +#[CoversClass(Select::class)] class SelectTest extends AbstractTestCase { /** @@ -60,9 +62,8 @@ class SelectTest extends AbstractTestCase /** * Test for Select::render - * - * @dataProvider renderDataProvider */ + #[DataProvider('renderDataProvider')] public function testRender(bool $notOnlyOptions, bool $omitFieldset): void { if ($notOnlyOptions) { diff --git a/test/classes/Server/SysInfo/SysInfoTest.php b/test/classes/Server/SysInfo/SysInfoTest.php index 13a53d2c34..42974c7ef0 100644 --- a/test/classes/Server/SysInfo/SysInfoTest.php +++ b/test/classes/Server/SysInfo/SysInfoTest.php @@ -7,8 +7,10 @@ namespace PhpMyAdmin\Tests\Server\SysInfo; use PhpMyAdmin\Server\SysInfo\Base; use PhpMyAdmin\Server\SysInfo\SysInfo; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Server\SysInfo\SysInfo */ +#[CoversClass(SysInfo::class)] class SysInfoTest extends AbstractTestCase { /** @@ -16,9 +18,8 @@ class SysInfoTest extends AbstractTestCase * * @param string $os OS name as returned by PHP_OS * @param string $expected Expected detected OS name - * - * @dataProvider sysInfoOsProvider */ + #[DataProvider('sysInfoOsProvider')] public function testGetSysInfoOs(string $os, string $expected): void { $this->assertEquals( diff --git a/test/classes/Setup/ConfigGeneratorTest.php b/test/classes/Setup/ConfigGeneratorTest.php index 41d466c314..6019cb242f 100644 --- a/test/classes/Setup/ConfigGeneratorTest.php +++ b/test/classes/Setup/ConfigGeneratorTest.php @@ -8,6 +8,8 @@ use PhpMyAdmin\Config\ConfigFile; use PhpMyAdmin\Setup\ConfigGenerator; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Version; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use function explode; @@ -17,14 +19,13 @@ use function str_repeat; use const SODIUM_CRYPTO_SECRETBOX_KEYBYTES; -/** @covers \PhpMyAdmin\Setup\ConfigGenerator */ +#[CoversClass(ConfigGenerator::class)] class ConfigGeneratorTest extends AbstractTestCase { /** * Test for ConfigGenerator::getConfigFile - * - * @group medium */ + #[Group('medium')] public function testGetConfigFile(): void { unset($_SESSION['eol']); diff --git a/test/classes/Setup/FormProcessingTest.php b/test/classes/Setup/FormProcessingTest.php index b76db273d3..e4418770e6 100644 --- a/test/classes/Setup/FormProcessingTest.php +++ b/test/classes/Setup/FormProcessingTest.php @@ -8,11 +8,12 @@ use PhpMyAdmin\Config\FormDisplay; use PhpMyAdmin\Exceptions\ExitException; use PhpMyAdmin\Setup\FormProcessing; use PhpMyAdmin\Tests\AbstractNetworkTestCase; +use PHPUnit\Framework\Attributes\CoversClass; use function ob_get_clean; use function ob_start; -/** @covers \PhpMyAdmin\Setup\FormProcessing */ +#[CoversClass(FormProcessing::class)] class FormProcessingTest extends AbstractNetworkTestCase { /** diff --git a/test/classes/Setup/IndexTest.php b/test/classes/Setup/IndexTest.php index 98caf7f0eb..a3242af096 100644 --- a/test/classes/Setup/IndexTest.php +++ b/test/classes/Setup/IndexTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Setup; use PhpMyAdmin\Setup\Index as SetupIndex; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Setup\Index */ +#[CoversClass(SetupIndex::class)] class IndexTest extends AbstractTestCase { /** diff --git a/test/classes/ShowGrantsTest.php b/test/classes/ShowGrantsTest.php index b83eae3ca4..932d22a288 100644 --- a/test/classes/ShowGrantsTest.php +++ b/test/classes/ShowGrantsTest.php @@ -5,8 +5,9 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\ShowGrants; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\ShowGrants */ +#[CoversClass(ShowGrants::class)] class ShowGrantsTest extends AbstractTestCase { public function test1(): void diff --git a/test/classes/SqlQueryFormTest.php b/test/classes/SqlQueryFormTest.php index 192f6a0e85..6b3d167bcf 100644 --- a/test/classes/SqlQueryFormTest.php +++ b/test/classes/SqlQueryFormTest.php @@ -13,12 +13,13 @@ use PhpMyAdmin\SqlQueryForm; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; use function __; use function htmlspecialchars; -/** @covers \PhpMyAdmin\SqlQueryForm */ +#[CoversClass(SqlQueryForm::class)] class SqlQueryFormTest extends AbstractTestCase { protected DatabaseInterface $dbi; diff --git a/test/classes/SqlTest.php b/test/classes/SqlTest.php index 959fcc9273..4f0aea68ff 100644 --- a/test/classes/SqlTest.php +++ b/test/classes/SqlTest.php @@ -13,6 +13,8 @@ use PhpMyAdmin\Sql; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use ReflectionMethod; use stdClass; @@ -20,7 +22,7 @@ use const MYSQLI_TYPE_SHORT; use const MYSQLI_TYPE_TIMESTAMP; use const MYSQLI_TYPE_VAR_STRING; -/** @covers \PhpMyAdmin\Sql */ +#[CoversClass(Sql::class)] class SqlTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -398,11 +400,8 @@ class SqlTest extends AbstractTestCase ]; } - /** - * @param mixed[] $sessionTmpVal - * - * @dataProvider dataProviderCountQueryResults - */ + /** @param mixed[] $sessionTmpVal */ + #[DataProvider('dataProviderCountQueryResults')] public function testCountQueryResults( string|null $sqlQuery, array $sessionTmpVal, diff --git a/test/classes/StatementInfoTest.php b/test/classes/StatementInfoTest.php index 76b16a774e..dbeed08843 100644 --- a/test/classes/StatementInfoTest.php +++ b/test/classes/StatementInfoTest.php @@ -6,9 +6,10 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\StatementInfo; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\StatementInfo */ +#[CoversClass(StatementInfo::class)] class StatementInfoTest extends TestCase { public function testFromArray(): void diff --git a/test/classes/StorageEngineTest.php b/test/classes/StorageEngineTest.php index 39bb93454f..42ebe505c9 100644 --- a/test/classes/StorageEngineTest.php +++ b/test/classes/StorageEngineTest.php @@ -20,11 +20,15 @@ use PhpMyAdmin\Engines\Pbxt; use PhpMyAdmin\Engines\PerformanceSchema; use PhpMyAdmin\StorageEngine; use PhpMyAdmin\Tests\Stubs\DbiDummy; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use PHPUnit\Framework\MockObject\MockObject; use function json_encode; -/** @covers \PhpMyAdmin\StorageEngine */ +#[CoversClass(StorageEngine::class)] class StorageEngineTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -63,10 +67,8 @@ class StorageEngineTest extends AbstractTestCase unset($this->object); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testGetStorageEngines(): void { $this->assertEquals( @@ -100,9 +102,8 @@ class StorageEngineTest extends AbstractTestCase * @param string $expectedClass Class that should be selected * @param string $engineName Engine name * @psalm-param class-string $expectedClass - * - * @dataProvider providerGetEngine */ + #[DataProvider('providerGetEngine')] public function testGetEngine(string $expectedClass, string $engineName): void { $actual = StorageEngine::getEngine($engineName); diff --git a/test/classes/SystemDatabaseTest.php b/test/classes/SystemDatabaseTest.php index a78f0b18f2..983dd67a0f 100644 --- a/test/classes/SystemDatabaseTest.php +++ b/test/classes/SystemDatabaseTest.php @@ -10,11 +10,12 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\SystemColumn; use PhpMyAdmin\SystemDatabase; use PhpMyAdmin\Tests\Stubs\DummyResult; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; use const MYSQLI_TYPE_STRING; -/** @covers \PhpMyAdmin\SystemDatabase */ +#[CoversClass(SystemDatabase::class)] class SystemDatabaseTest extends AbstractTestCase { /** diff --git a/test/classes/Table/ColumnsDefinitionTest.php b/test/classes/Table/ColumnsDefinitionTest.php index c493608452..82c0fda58e 100644 --- a/test/classes/Table/ColumnsDefinitionTest.php +++ b/test/classes/Table/ColumnsDefinitionTest.php @@ -9,12 +9,14 @@ use PhpMyAdmin\Table\ColumnsDefinition; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\FieldHelper; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function array_merge; use const MYSQLI_TYPE_STRING; -/** @covers \PhpMyAdmin\Table\ColumnsDefinition */ +#[CoversClass(ColumnsDefinition::class)] class ColumnsDefinitionTest extends AbstractTestCase { public function testDisplayForm(): void @@ -209,9 +211,8 @@ SQL; * @param array $expected expected result * @phpstan-param array $columnMeta * @phpstan-param array $expected - * - * @dataProvider providerColumnMetaDefault */ + #[DataProvider('providerColumnMetaDefault')] public function testDecorateColumnMetaDefault(array $columnMeta, array $expected): void { $result = ColumnsDefinition::decorateColumnMetaDefault($columnMeta); diff --git a/test/classes/Table/IndexesTest.php b/test/classes/Table/IndexesTest.php index 20fda7b701..9fb6d714c5 100644 --- a/test/classes/Table/IndexesTest.php +++ b/test/classes/Table/IndexesTest.php @@ -12,8 +12,9 @@ use PhpMyAdmin\Table\Indexes; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Table\Indexes */ +#[CoversClass(Indexes::class)] class IndexesTest extends AbstractTestCase { protected function setUp(): void diff --git a/test/classes/Table/Maintenance/MessageTest.php b/test/classes/Table/Maintenance/MessageTest.php index 934d95a1dd..7975eec003 100644 --- a/test/classes/Table/Maintenance/MessageTest.php +++ b/test/classes/Table/Maintenance/MessageTest.php @@ -5,16 +5,15 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Table\Maintenance; use PhpMyAdmin\Table\Maintenance\Message; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Table\Maintenance\Message */ +#[CoversClass(Message::class)] class MessageTest extends TestCase { - /** - * @param mixed[] $row - * - * @dataProvider providerForTestFromArray - */ + /** @param mixed[] $row */ + #[DataProvider('providerForTestFromArray')] public function testFromArray(array $row, string $table, string $operation, string $type, string $text): void { $message = Message::fromArray($row); diff --git a/test/classes/Table/SearchTest.php b/test/classes/Table/SearchTest.php index 25368e4172..f762057db2 100644 --- a/test/classes/Table/SearchTest.php +++ b/test/classes/Table/SearchTest.php @@ -6,8 +6,9 @@ namespace PhpMyAdmin\Tests\Table; use PhpMyAdmin\Table\Search; use PhpMyAdmin\Tests\AbstractTestCase; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Table\Search */ +#[CoversClass(Search::class)] class SearchTest extends AbstractTestCase { private Search $search; diff --git a/test/classes/TableTest.php b/test/classes/TableTest.php index 895fa7aaed..92157fdcfe 100644 --- a/test/classes/TableTest.php +++ b/test/classes/TableTest.php @@ -13,8 +13,10 @@ use PhpMyAdmin\Query\Cache; use PhpMyAdmin\Table; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Tests\Stubs\DummyResult; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Table */ +#[CoversClass(Table::class)] class TableTest extends AbstractTestCase { /** @@ -366,9 +368,8 @@ class TableTest extends AbstractTestCase * @param string $name name to test * @param bool $result expected result * @param bool $isBackquoted is backquoted - * - * @dataProvider dataValidateName */ + #[DataProvider('dataValidateName')] public function testValidateName(string $name, bool $result, bool $isBackquoted = false): void { $this->assertEquals( diff --git a/test/classes/TemplateTest.php b/test/classes/TemplateTest.php index 10adab631c..0352509e22 100644 --- a/test/classes/TemplateTest.php +++ b/test/classes/TemplateTest.php @@ -7,11 +7,13 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\Config; use PhpMyAdmin\Template; use PhpMyAdmin\Twig\Extensions\Node\TransNode; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\PreserveGlobalState; use PHPUnit\Framework\Attributes\RunInSeparateProcess; use Twig\Error\LoaderError; -/** @covers \PhpMyAdmin\Template */ +#[CoversClass(Template::class)] class TemplateTest extends AbstractTestCase { protected Template $template; @@ -48,9 +50,8 @@ class TemplateTest extends AbstractTestCase * Test for set function * * @param string $data Template name - * - * @dataProvider providerTestSet */ + #[DataProvider('providerTestSet')] public function testSet(string $data): void { $result = $this->template->render($data, ['variable1' => 'value1', 'variable2' => 'value2']); @@ -74,9 +75,8 @@ class TemplateTest extends AbstractTestCase * @param string $templateFile Template name * @param string $key Template variable array key * @param string $value Template variable array value - * - * @dataProvider providerTestDynamicRender */ + #[DataProvider('providerTestDynamicRender')] public function testDynamicRender(string $templateFile, string $key, string $value): void { $this->assertEquals( @@ -109,9 +109,8 @@ class TemplateTest extends AbstractTestCase * * @param string $templateFile Template name * @param string $expectedResult Expected result - * - * @dataProvider providerTestRender */ + #[DataProvider('providerTestRender')] public function testRender(string $templateFile, string $expectedResult): void { $this->assertEquals( @@ -136,9 +135,8 @@ class TemplateTest extends AbstractTestCase * @param string $templateFile Template name * @param mixed[] $renderParams Render params * @param string $expectedResult Expected result - * - * @dataProvider providerTestRenderGettext */ + #[DataProvider('providerTestRenderGettext')] public function testRenderGettext(string $templateFile, array $renderParams, string $expectedResult): void { $this->assertEquals( diff --git a/test/classes/Theme/ThemeManagerTest.php b/test/classes/Theme/ThemeManagerTest.php index 916da60144..1736a30914 100644 --- a/test/classes/Theme/ThemeManagerTest.php +++ b/test/classes/Theme/ThemeManagerTest.php @@ -7,8 +7,9 @@ namespace PhpMyAdmin\Tests\Theme; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Theme\ThemeManager; +use PHPUnit\Framework\Attributes\CoversClass; -/** @covers \PhpMyAdmin\Theme\ThemeManager */ +#[CoversClass(ThemeManager::class)] class ThemeManagerTest extends AbstractTestCase { /** diff --git a/test/classes/Theme/ThemeTest.php b/test/classes/Theme/ThemeTest.php index c9a89f42d3..c579016ecb 100644 --- a/test/classes/Theme/ThemeTest.php +++ b/test/classes/Theme/ThemeTest.php @@ -7,6 +7,10 @@ namespace PhpMyAdmin\Tests\Theme; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Theme\Theme; use PhpMyAdmin\Theme\ThemeManager; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Depends; +use PHPUnit\Framework\Attributes\Group; use function filemtime; @@ -14,7 +18,7 @@ use const DIRECTORY_SEPARATOR; use const ROOT_PATH; use const TEST_PATH; -/** @covers \PhpMyAdmin\Theme\Theme */ +#[CoversClass(Theme::class)] class ThemeTest extends AbstractTestCase { protected Theme $object; @@ -55,9 +59,8 @@ class ThemeTest extends AbstractTestCase /** * Test for Theme::loadInfo - * - * @group medium */ + #[Group('medium')] public function testCheckImgPathNotExisted(): void { $this->object->setPath('path/to/nowhere'); @@ -166,9 +169,8 @@ class ThemeTest extends AbstractTestCase /** * Test for Theme::checkVersion - * - * @depends testLoadInfo */ + #[Depends('testLoadInfo')] public function testGetSetCheckVersion(): void { $this->assertEquals( @@ -226,9 +228,8 @@ class ThemeTest extends AbstractTestCase * @param string|null $file file name for image * @param string|null $fallback fallback image * @param string $output expected output - * - * @dataProvider providerForGetImgPath */ + #[DataProvider('providerForGetImgPath')] public function testGetImgPath(string|null $file, string|null $fallback, string $output): void { $this->assertEquals( diff --git a/test/classes/Tracking/TrackerTest.php b/test/classes/Tracking/TrackerTest.php index 39001dea2d..eb1eaf2a1a 100644 --- a/test/classes/Tracking/TrackerTest.php +++ b/test/classes/Tracking/TrackerTest.php @@ -13,10 +13,12 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Tracking\Tracker; use PhpMyAdmin\Util; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use ReflectionClass; use ReflectionMethod; -/** @covers \PhpMyAdmin\Tracking\Tracker */ +#[CoversClass(Tracker::class)] class TrackerTest extends AbstractTestCase { /** @@ -330,9 +332,8 @@ class TrackerTest extends AbstractTestCase * @param string|null $tableName Expected tablename * @param string|null $db Expected dbname * @param string|null $tableNameAfterRename Expected name after rename - * - * @dataProvider parseQueryData */ + #[DataProvider('parseQueryData')] public function testParseQuery( string $query, string $type, diff --git a/test/classes/Tracking/TrackingCheckerTest.php b/test/classes/Tracking/TrackingCheckerTest.php index 3ba459ad67..1cf5c7fec0 100644 --- a/test/classes/Tracking/TrackingCheckerTest.php +++ b/test/classes/Tracking/TrackingCheckerTest.php @@ -12,9 +12,10 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tracking\TrackedTable; use PhpMyAdmin\Tracking\Tracker; use PhpMyAdmin\Tracking\TrackingChecker; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; -/** @covers \PhpMyAdmin\Tracking\TrackingChecker */ +#[CoversClass(TrackingChecker::class)] class TrackingCheckerTest extends AbstractTestCase { private TrackingChecker $trackingChecker; diff --git a/test/classes/Tracking/TrackingTest.php b/test/classes/Tracking/TrackingTest.php index 1d0bdd3658..4af310dcd4 100644 --- a/test/classes/Tracking/TrackingTest.php +++ b/test/classes/Tracking/TrackingTest.php @@ -18,6 +18,8 @@ use PhpMyAdmin\Tracking\Tracking; use PhpMyAdmin\Tracking\TrackingChecker; use PhpMyAdmin\Url; use PhpMyAdmin\Util; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use ReflectionClass; use function __; @@ -29,7 +31,7 @@ use function ini_restore; use function ini_set; use function sprintf; -/** @covers \PhpMyAdmin\Tracking\Tracking */ +#[CoversClass(Tracking::class)] class TrackingTest extends AbstractTestCase { private Tracking $tracking; @@ -661,9 +663,8 @@ class TrackingTest extends AbstractTestCase * * @param mixed[] $fetchArrayReturn Value to be returned by mocked fetchArray * @param TrackedData $expected Expected value - * - * @dataProvider getTrackedDataProvider */ + #[DataProvider('getTrackedDataProvider')] public function testGetTrackedData(array $fetchArrayReturn, TrackedData $expected): void { $resultStub = $this->createMock(DummyResult::class); diff --git a/test/classes/TransformationsTest.php b/test/classes/TransformationsTest.php index e8ae8d959c..786325799d 100644 --- a/test/classes/TransformationsTest.php +++ b/test/classes/TransformationsTest.php @@ -9,9 +9,13 @@ use PhpMyAdmin\ConfigStorage\RelationParameters; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Transformations; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use ReflectionClass; -/** @covers \PhpMyAdmin\Transformations */ +#[CoversClass(Transformations::class)] class TransformationsTest extends AbstractTestCase { private Transformations $transformations; @@ -45,9 +49,8 @@ class TransformationsTest extends AbstractTestCase * * @param string $input String to parse * @param mixed[] $expected Expected result - * - * @dataProvider getOptionsData */ + #[DataProvider('getOptionsData')] public function testGetOptions(string $input, array $expected): void { $this->assertEquals( @@ -72,10 +75,8 @@ class TransformationsTest extends AbstractTestCase ]; } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testGetTypes(): void { $this->assertEquals( @@ -240,9 +241,8 @@ class TransformationsTest extends AbstractTestCase /** * @param string $value value * @param string $expected expected result - * - * @dataProvider fixupData */ + #[DataProvider('fixupData')] public function testFixup(string $value, string $expected): void { $this->assertEquals( @@ -268,9 +268,8 @@ class TransformationsTest extends AbstractTestCase * * @param string $file transformation file * @param string $expectedDescription expected description - * - * @dataProvider providerGetDescription */ + #[DataProvider('providerGetDescription')] public function testGetDescription(string $file, string $expectedDescription): void { $this->assertEquals( @@ -294,9 +293,8 @@ class TransformationsTest extends AbstractTestCase * * @param string $file transformation file * @param string $expectedName expected name - * - * @dataProvider providerGetName */ + #[DataProvider('providerGetName')] public function testGetName(string $file, string $expectedName): void { $this->assertEquals( diff --git a/test/classes/Triggers/TriggerTest.php b/test/classes/Triggers/TriggerTest.php index 40e2240f11..f14de44057 100644 --- a/test/classes/Triggers/TriggerTest.php +++ b/test/classes/Triggers/TriggerTest.php @@ -7,9 +7,11 @@ namespace PhpMyAdmin\Tests\Triggers; use PhpMyAdmin\Triggers\Event; use PhpMyAdmin\Triggers\Timing; use PhpMyAdmin\Triggers\Trigger; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Triggers\Trigger */ +#[CoversClass(Trigger::class)] class TriggerTest extends TestCase { public function testTryFromArrayWithEmptyArray(): void @@ -17,11 +19,8 @@ class TriggerTest extends TestCase $this->assertNull(Trigger::tryFromArray([])); } - /** - * @param mixed[] $trigger - * - * @dataProvider arrayWithValidValuesProvider - */ + /** @param mixed[] $trigger */ + #[DataProvider('arrayWithValidValuesProvider')] public function testTryFromArrayWithValidValues(array $trigger): void { $actual = Trigger::tryFromArray($trigger); @@ -60,11 +59,8 @@ class TriggerTest extends TestCase ]; } - /** - * @param mixed[] $trigger - * - * @dataProvider arrayWithInvalidValuesProvider - */ + /** @param mixed[] $trigger */ + #[DataProvider('arrayWithInvalidValuesProvider')] public function testTryFromArrayWithInvalidValues(array $trigger): void { $this->assertNull(Trigger::tryFromArray($trigger)); diff --git a/test/classes/Triggers/TriggersTest.php b/test/classes/Triggers/TriggersTest.php index 61b6c06f5f..e15478d1e5 100644 --- a/test/classes/Triggers/TriggersTest.php +++ b/test/classes/Triggers/TriggersTest.php @@ -7,12 +7,14 @@ namespace PhpMyAdmin\Tests\Triggers; use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; +use PhpMyAdmin\Triggers\Trigger; use PhpMyAdmin\Triggers\Triggers; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; -/** - * @covers \PhpMyAdmin\Triggers\Trigger - * @covers \PhpMyAdmin\Triggers\Triggers - */ +#[CoversClass(Trigger::class)] +#[CoversClass(Triggers::class)] class TriggersTest extends AbstractTestCase { private Triggers $triggers; @@ -48,9 +50,8 @@ class TriggersTest extends AbstractTestCase * * @param array $in Input * @param array $out Expected output - * - * @dataProvider providerGetDataFromRequestEmpty */ + #[DataProvider('providerGetDataFromRequestEmpty')] public function testGetDataFromRequestEmpty(array $in, array $out): void { unset($_POST); @@ -120,10 +121,9 @@ class TriggersTest extends AbstractTestCase * Test for getEditorForm * * @param array $data Data for trigger - * - * @dataProvider providerGetEditorFormAdd - * @group medium */ + #[DataProvider('providerGetEditorFormAdd')] + #[Group('medium')] public function testGetEditorFormAdd(array $data, string $matcher): void { $GLOBALS['server'] = 1; @@ -166,10 +166,9 @@ class TriggersTest extends AbstractTestCase * Test for getEditorForm * * @param array $data Data for trigger - * - * @dataProvider providerGetEditorFormEdit - * @group medium */ + #[DataProvider('providerGetEditorFormEdit')] + #[Group('medium')] public function testGetEditorFormEdit(array $data, string $matcher): void { $GLOBALS['server'] = 1; @@ -212,9 +211,8 @@ class TriggersTest extends AbstractTestCase * Test for getEditorForm * * @param array $data Data for trigger - * - * @dataProvider providerGetEditorFormAjax */ + #[DataProvider('providerGetEditorFormAjax')] public function testGetEditorFormAjax(array $data, string $matcher): void { $GLOBALS['server'] = 1; @@ -257,9 +255,8 @@ class TriggersTest extends AbstractTestCase * @param string $definition Definition * @param string $query Query * @param int $numErr Error number - * - * @dataProvider providerGetQueryFromRequest */ + #[DataProvider('providerGetQueryFromRequest')] public function testGetQueryFromRequest( string $definer, string $name, @@ -396,7 +393,6 @@ class TriggersTest extends AbstractTestCase $this->assertSame($expected, $triggers); } - /** @covers \PhpMyAdmin\Query\Generator */ public function testGetDetails3(): void { $GLOBALS['cfg']['Server']['DisableIS'] = false; @@ -426,7 +422,6 @@ class TriggersTest extends AbstractTestCase $this->assertSame($expected, $triggers); } - /** @covers \PhpMyAdmin\Query\Generator */ public function testGetDetails4(): void { $GLOBALS['cfg']['Server']['DisableIS'] = false; diff --git a/test/classes/TwoFactorTest.php b/test/classes/TwoFactorTest.php index ff564e33e9..dd4c6928d7 100644 --- a/test/classes/TwoFactorTest.php +++ b/test/classes/TwoFactorTest.php @@ -10,6 +10,9 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Plugins\TwoFactor\Application; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\TwoFactor; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use function count; use function in_array; @@ -18,7 +21,7 @@ use function str_replace; use const JSON_UNESCAPED_SLASHES; -/** @covers \PhpMyAdmin\TwoFactor */ +#[CoversClass(TwoFactor::class)] class TwoFactorTest extends AbstractTestCase { protected DatabaseInterface $dbi; @@ -238,11 +241,9 @@ class TwoFactorTest extends AbstractTestCase $this->dummyDbi->assertAllQueriesConsumed(); } - /** - * @group extension-iconv - * @requires extension xmlwriter - * @requires extension iconv - */ + #[Group('extension-iconv')] + #[RequiresPhpExtension('iconv')] + #[RequiresPhpExtension('xmlwriter')] public function testApplication(): void { parent::setLanguage(); diff --git a/test/classes/TypesByDatabaseVersionTest.php b/test/classes/TypesByDatabaseVersionTest.php index 5eb3ff86bd..43e7f5d8b4 100644 --- a/test/classes/TypesByDatabaseVersionTest.php +++ b/test/classes/TypesByDatabaseVersionTest.php @@ -6,9 +6,11 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Types; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\MockObject\Stub; -/** @covers \PhpMyAdmin\Types */ +#[CoversClass(Types::class)] class TypesByDatabaseVersionTest extends AbstractTestCase { /** @var DatabaseInterface&Stub */ @@ -47,9 +49,8 @@ class TypesByDatabaseVersionTest extends AbstractTestCase * @param array $excludes Expected elements should not contain in result * @phpstan-param array $includes * @phpstan-param array $excludes - * - * @dataProvider providerFortTestGetFunctionsClass */ + #[DataProvider('providerFortTestGetFunctionsClass')] public function testGetFunctionsClass( string $database, int $dbVersion, @@ -272,9 +273,8 @@ class TypesByDatabaseVersionTest extends AbstractTestCase * @param array $excludes Expected elements should not contain in result * @phpstan-param array $includes * @phpstan-param array $excludes - * - * @dataProvider providerFortTestGetFunctions */ + #[DataProvider('providerFortTestGetFunctions')] public function testGetFunctions(string $database, int $dbVersion, array $includes, array $excludes): void { $this->createObject($database, $dbVersion); @@ -348,9 +348,8 @@ class TypesByDatabaseVersionTest extends AbstractTestCase * @param array $excludes Expected elements should not contain in result * @phpstan-param array $includes * @phpstan-param array $excludes - * - * @dataProvider providerFortTestGetAllFunctions */ + #[DataProvider('providerFortTestGetAllFunctions')] public function testGetAllFunctions(string $database, int $dbVersion, array $includes, array $excludes): void { $this->createObject($database, $dbVersion); @@ -608,9 +607,8 @@ class TypesByDatabaseVersionTest extends AbstractTestCase * @param int $dbVersion Database Version * @param array $expected Expected Result * @phpstan-param array|string> $expected - * - * @dataProvider providerFortTestGetColumns */ + #[DataProvider('providerFortTestGetColumns')] public function testGetColumns(string $database, int $dbVersion, array $expected): void { $this->createObject($database, $dbVersion); diff --git a/test/classes/TypesTest.php b/test/classes/TypesTest.php index e98be19c50..9033bff4a3 100644 --- a/test/classes/TypesTest.php +++ b/test/classes/TypesTest.php @@ -5,8 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Types; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Types */ +#[CoversClass(Types::class)] class TypesTest extends AbstractTestCase { protected Types $object; @@ -135,9 +137,8 @@ class TypesTest extends AbstractTestCase * @param string $type Type of field * @param bool $null Whether field can be NULL * @param string|string[] $output Expected output - * - * @dataProvider providerForGetTypeOperators */ + #[DataProvider('providerForGetTypeOperators')] public function testGetTypeOperators(string $type, bool $null, string|array $output): void { $this->assertEquals( @@ -229,9 +230,8 @@ class TypesTest extends AbstractTestCase * @param bool $null Whether field can be NULL * @param string $selectedOperator Option to be selected * @param string $output Expected output - * - * @dataProvider providerForTestGetTypeOperatorsHtml */ + #[DataProvider('providerForTestGetTypeOperatorsHtml')] public function testGetTypeOperatorsHtml( string $type, bool $null, @@ -260,9 +260,8 @@ class TypesTest extends AbstractTestCase * Test for getTypeDescription * * @param string $type The data type to get a description. - * - * @dataProvider providerForTestGetTypeDescription */ + #[DataProvider('providerForTestGetTypeDescription')] public function testGetTypeDescription(string $type): void { $this->assertNotEquals( @@ -338,9 +337,8 @@ class TypesTest extends AbstractTestCase /** * @param string $class The class to get function list. * @param string[] $output Expected function list - * - * @dataProvider providerFortTestGetFunctionsClass */ + #[DataProvider('providerFortTestGetFunctionsClass')] public function testGetFunctionsClass(string $class, array $output): void { $this->assertEquals( @@ -752,9 +750,8 @@ class TypesTest extends AbstractTestCase /** * @param string $type Type to check * @param string $output Expected result - * - * @dataProvider providerFortTestGetTypeClass */ + #[DataProvider('providerFortTestGetTypeClass')] public function testGetTypeClass(string $type, string $output): void { $this->assertEquals( diff --git a/test/classes/UrlTest.php b/test/classes/UrlTest.php index e6f44f7779..bc8e6d4259 100644 --- a/test/classes/UrlTest.php +++ b/test/classes/UrlTest.php @@ -5,13 +5,14 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Url; +use PHPUnit\Framework\Attributes\CoversClass; use function is_string; use function parse_str; use function str_repeat; use function urldecode; -/** @covers \PhpMyAdmin\Url */ +#[CoversClass(Url::class)] class UrlTest extends AbstractTestCase { /** diff --git a/test/classes/UserPasswordTest.php b/test/classes/UserPasswordTest.php index b40f22cd56..5ce7c0f9a2 100644 --- a/test/classes/UserPasswordTest.php +++ b/test/classes/UserPasswordTest.php @@ -12,10 +12,12 @@ use PhpMyAdmin\Server\Plugins; use PhpMyAdmin\Server\Privileges; use PhpMyAdmin\Template; use PhpMyAdmin\UserPassword; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function str_repeat; -/** @covers \PhpMyAdmin\UserPassword */ +#[CoversClass(UserPassword::class)] class UserPasswordTest extends AbstractTestCase { private UserPassword $object; @@ -41,7 +43,7 @@ class UserPasswordTest extends AbstractTestCase ); } - /** @dataProvider providerSetChangePasswordMsg */ + #[DataProvider('providerSetChangePasswordMsg')] public function testSetChangePasswordMsg( bool $error, Message $message, diff --git a/test/classes/UserPreferencesTest.php b/test/classes/UserPreferencesTest.php index 210628030c..6f3d182535 100644 --- a/test/classes/UserPreferencesTest.php +++ b/test/classes/UserPreferencesTest.php @@ -13,12 +13,13 @@ use PhpMyAdmin\Message; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Url; use PhpMyAdmin\UserPreferences; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; use function json_encode; use function time; -/** @covers \PhpMyAdmin\UserPreferences */ +#[CoversClass(UserPreferences::class)] class UserPreferencesTest extends AbstractNetworkTestCase { /** diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php index 3bf77377b8..c303292229 100644 --- a/test/classes/UtilTest.php +++ b/test/classes/UtilTest.php @@ -13,6 +13,9 @@ use PhpMyAdmin\SqlParser\Token; use PhpMyAdmin\Util; use PhpMyAdmin\Utils\SessionCache; use PhpMyAdmin\Version; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Psr\Http\Message\ServerRequestInterface; use function __; @@ -44,17 +47,16 @@ const FIELD_TYPE_INTEGER = 1; const FIELD_TYPE_VARCHAR = 253; const FIELD_TYPE_UNKNOWN = -1; -/** @covers \PhpMyAdmin\Util */ +#[CoversClass(Util::class)] class UtilTest extends AbstractTestCase { /** * Test for listPHPExtensions - * - * @requires extension mysqli - * @requires extension curl - * @requires extension mbstring - * @requires extension sodium */ + #[RequiresPhpExtension('curl')] + #[RequiresPhpExtension('mbstring')] + #[RequiresPhpExtension('mysqli')] + #[RequiresPhpExtension('sodium')] public function testListPHPExtensions(): void { $this->assertSame( @@ -278,9 +280,8 @@ class UtilTest extends AbstractTestCase * @param array $expected Expected Result * @psalm-param array $row * @psalm-param array{string, bool, array} $expected - * - * @dataProvider providerGetUniqueConditionForGroupFlag */ + #[DataProvider('providerGetUniqueConditionForGroupFlag')] public function testGetUniqueConditionForGroupFlag(array $meta, array $row, array $expected): void { $GLOBALS['dbi'] = $this->createDatabaseInterface(); @@ -413,9 +414,8 @@ class UtilTest extends AbstractTestCase * * @param string $collation Collation * @param string $expected Expected Charset Query - * - * @dataProvider charsetQueryData */ + #[DataProvider('charsetQueryData')] public function testGenerateCharsetQueryPart(string $collation, string $expected): void { $this->assertEquals( @@ -462,9 +462,8 @@ class UtilTest extends AbstractTestCase * * @param string|null $bit Value * @param string $val Expected value - * - * @dataProvider providerConvertBitDefaultValue */ + #[DataProvider('providerConvertBitDefaultValue')] public function testConvertBitDefaultValue(string|null $bit, string $val): void { $this->assertEquals( @@ -497,9 +496,8 @@ class UtilTest extends AbstractTestCase * * @param string $in string to evaluate * @param string $out expected output - * - * @dataProvider providerExpandUserString */ + #[DataProvider('providerExpandUserString')] public function testExpandUserString(string $in, string $out): void { parent::setGlobalConfig(); @@ -544,9 +542,8 @@ class UtilTest extends AbstractTestCase * * @param string $in Column specification * @param mixed[] $out Expected value - * - * @dataProvider providerExtractColumnSpec */ + #[DataProvider('providerExtractColumnSpec')] public function testExtractColumnSpec(string $in, array $out): void { $GLOBALS['cfg']['LimitChars'] = 1000; @@ -693,9 +690,8 @@ class UtilTest extends AbstractTestCase * * @param int|string $size Size * @param int|float $expected Expected value (float on some cpu architectures) - * - * @dataProvider providerExtractValueFromFormattedSize */ + #[DataProvider('providerExtractValueFromFormattedSize')] public function testExtractValueFromFormattedSize(int|string $size, int|float $expected): void { $this->assertEquals( @@ -726,9 +722,8 @@ class UtilTest extends AbstractTestCase * @param int $b Sensitiveness * @param int $c Number of decimals to retain * @param mixed[] $e Expected value - * - * @dataProvider providerFormatByteDown */ + #[DataProvider('providerFormatByteDown')] public function testFormatByteDown(float|int|string $a, int $b, int $c, array $e): void { $result = Util::formatByteDown($a, $b, $c); @@ -794,9 +789,8 @@ class UtilTest extends AbstractTestCase * @param int $b Sensitiveness * @param int $c Number of decimals to retain * @param string $d Expected value - * - * @dataProvider providerFormatNumber */ + #[DataProvider('providerFormatNumber')] public function testFormatNumber(float|int|string $a, int $b, int $c, string $d): void { $this->assertFormatNumber($a, $b, $c, $d); @@ -875,9 +869,8 @@ class UtilTest extends AbstractTestCase * @param int|float|string $size Size (float on some cpu architectures) * @param string $unit Unit * @param string $res Result - * - * @dataProvider providerGetFormattedMaximumUploadSize */ + #[DataProvider('providerGetFormattedMaximumUploadSize')] public function testGetFormattedMaximumUploadSize(int|float|string $size, string $unit, string $res): void { $this->assertEquals( @@ -918,9 +911,8 @@ class UtilTest extends AbstractTestCase * * @param string $target Target * @param string $result Expected value - * - * @dataProvider providerGetTitleForTarget */ + #[DataProvider('providerGetTitleForTarget')] public function testGetTitleForTarget(string $target, string $result): void { $this->assertEquals( @@ -954,9 +946,8 @@ class UtilTest extends AbstractTestCase * @param string $e Expected output * @param string $tz Timezone to set * @param string $locale Locale to set - * - * @dataProvider providerLocalisedDate */ + #[DataProvider('providerLocalisedDate')] public function testLocalisedDate(int $a, string $b, string $e, string $tz, string $locale): void { parent::setLanguage(); @@ -1038,9 +1029,8 @@ class UtilTest extends AbstractTestCase * * @param int $a Timespan in seconds * @param string $e Expected output - * - * @dataProvider providerTimespanFormat */ + #[DataProvider('providerTimespanFormat')] public function testTimespanFormat(int $a, string $e): void { $GLOBALS['timespanfmt'] = '%s days, %s hours, %s minutes and %s seconds'; @@ -1074,9 +1064,8 @@ class UtilTest extends AbstractTestCase * @param int $a Value * @param int $b Length * @param string $e Expected output - * - * @dataProvider providerPrintableBitValue */ + #[DataProvider('providerPrintableBitValue')] public function testPrintableBitValue(int $a, int $b, string $e): void { $this->assertEquals( @@ -1103,9 +1092,8 @@ class UtilTest extends AbstractTestCase * * @param string $param String * @param string $expected Expected output - * - * @dataProvider providerUnQuote */ + #[DataProvider('providerUnQuote')] public function testUnQuote(string $param, string $expected): void { $this->assertEquals( @@ -1129,9 +1117,8 @@ class UtilTest extends AbstractTestCase * * @param string $param String * @param string $expected Expected output - * - * @dataProvider providerUnQuoteSelectedChar */ + #[DataProvider('providerUnQuoteSelectedChar')] public function testUnQuoteSelectedChar(string $param, string $expected): void { $this->assertEquals( @@ -1150,7 +1137,7 @@ class UtilTest extends AbstractTestCase return [['"test\'"', "test'"], ["'test''", "'test''"], ["`test'`", "`test'`"], ["'test'test", "'test'test"]]; } - /** @dataProvider providerForTestBackquote */ + #[DataProvider('providerForTestBackquote')] public function testBackquote(string|null $entry, string $expectedNoneOutput, string $expectedMssqlOutput): void { $this->assertSame($expectedNoneOutput, Util::backquote($entry)); @@ -1199,9 +1186,8 @@ class UtilTest extends AbstractTestCase * * @param string $a String * @param string $e Expected output - * - * @dataProvider providerUserDir */ + #[DataProvider('providerUserDir')] public function testUserDir(string $a, string $e): void { $GLOBALS['cfg']['Server']['user'] = 'root'; @@ -1224,9 +1210,8 @@ class UtilTest extends AbstractTestCase * * @param string $a String * @param string $e Expected output - * - * @dataProvider providerDuplicateFirstNewline */ + #[DataProvider('providerDuplicateFirstNewline')] public function testDuplicateFirstNewline(string $a, string $e): void { $this->assertEquals( @@ -1267,9 +1252,8 @@ class UtilTest extends AbstractTestCase * * @param bool $expected Expected result for a given input * @param mixed $input Input data to check - * - * @dataProvider providerIsInteger */ + #[DataProvider('providerIsInteger')] public function testIsInteger(bool $expected, mixed $input): void { $isInteger = Util::isInteger($input); @@ -1291,9 +1275,8 @@ class UtilTest extends AbstractTestCase * * @param string $header The http Forwarded header * @param string $proto The protocol http/https - * - * @dataProvider providerForwardedHeaders */ + #[DataProvider('providerForwardedHeaders')] public function testGetProtoFromForwardedHeader(string $header, string $proto): void { $protocolDetected = Util::getProtoFromForwardedHeader($header); @@ -1573,7 +1556,7 @@ SQL; ]; } - /** @dataProvider dataProviderScriptNames */ + #[DataProvider('dataProviderScriptNames')] public function testGetScriptNameForOption(string $target, string $location, string $finalLink): void { $GLOBALS['lang'] = 'en'; @@ -1603,7 +1586,7 @@ SQL; $this->assertFalse(Util::showText('ActionLinksMode')); } - /** @dataProvider providerForTestGetMySQLDocuURL */ + #[DataProvider('providerForTestGetMySQLDocuURL')] public function testGetMySQLDocuURL(string $link, string $anchor, string $version, string $expected): void { $GLOBALS['dbi'] = $this->createDatabaseInterface(); @@ -1763,9 +1746,8 @@ SQL; * @param bool $isMariaDB True if mariadb * @param int $version Database version as integer * @param bool $expected Expected Result - * - * @dataProvider provideForTestIsUUIDSupported */ + #[DataProvider('provideForTestIsUUIDSupported')] public function testIsUUIDSupported(bool $isMariaDB, int $version, bool $expected): void { $dbi = $this->getMockBuilder(DatabaseInterface::class) @@ -1796,7 +1778,7 @@ SQL; return [[false, 60100, false], [false, 100700, false], [true, 60100, false], [true, 100700, true]]; } - /** @dataProvider providerForTestGetLowerCaseNames */ + #[DataProvider('providerForTestGetLowerCaseNames')] public function testGetCollateForIS(string $lowerCaseTableNames, string $expected): void { $dbiDummy = $this->createDbiDummy(); diff --git a/test/classes/Utils/ForeignKeyTest.php b/test/classes/Utils/ForeignKeyTest.php index eee32e2bd1..49e0fb7899 100644 --- a/test/classes/Utils/ForeignKeyTest.php +++ b/test/classes/Utils/ForeignKeyTest.php @@ -7,8 +7,10 @@ namespace PhpMyAdmin\Tests\Utils; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Utils\ForeignKey; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** @covers \PhpMyAdmin\Utils\ForeignKey */ +#[CoversClass(ForeignKey::class)] class ForeignKeyTest extends AbstractTestCase { protected function setUp(): void @@ -23,9 +25,8 @@ class ForeignKeyTest extends AbstractTestCase * * @param string $a Engine * @param bool $e Expected Value - * - * @dataProvider providerIsSupported */ + #[DataProvider('providerIsSupported')] public function testIsSupported(string $a, bool $e): void { $GLOBALS['server'] = 1; @@ -72,7 +73,7 @@ class ForeignKeyTest extends AbstractTestCase return [['', 'OFF'], ['0', 'OFF'], ['1', 'ON']]; } - /** @dataProvider providerCheckInit */ + #[DataProvider('providerCheckInit')] public function testHandleDisableCheckInit(string $checksValue, string $setVariableParam): void { $dbi = $this->getMockBuilder(DatabaseInterface::class) @@ -94,7 +95,7 @@ class ForeignKeyTest extends AbstractTestCase $this->assertTrue(ForeignKey::handleDisableCheckInit()); } - /** @dataProvider providerCheckInit */ + #[DataProvider('providerCheckInit')] public function testHandleDisableCheckInitVarFalse(string $checksValue, string $setVariableParam): void { $dbi = $this->getMockBuilder(DatabaseInterface::class) @@ -122,7 +123,7 @@ class ForeignKeyTest extends AbstractTestCase return [[true, 'ON'], [false, 'OFF']]; } - /** @dataProvider providerCheckCleanup */ + #[DataProvider('providerCheckCleanup')] public function testHandleDisableCheckCleanup(bool $checkValue, string $setVariableParam): void { $dbi = $this->getMockBuilder(DatabaseInterface::class) diff --git a/test/classes/Utils/FormatConverterTest.php b/test/classes/Utils/FormatConverterTest.php index 77d1322304..81c9ee2612 100644 --- a/test/classes/Utils/FormatConverterTest.php +++ b/test/classes/Utils/FormatConverterTest.php @@ -6,10 +6,12 @@ namespace PhpMyAdmin\Tests\Utils; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Utils\FormatConverter; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function hex2bin; -/** @covers \PhpMyAdmin\Utils\FormatConverter */ +#[CoversClass(FormatConverter::class)] class FormatConverterTest extends AbstractTestCase { /** @@ -18,9 +20,8 @@ class FormatConverterTest extends AbstractTestCase * @param string $expected Expected result given an input * @param string $input Input to convert * @param bool $isBinary The data is binary data - * - * @dataProvider providerBinaryToIp */ + #[DataProvider('providerBinaryToIp')] public function testBinaryToIp(string $expected, string $input, bool $isBinary): void { $result = FormatConverter::binaryToIp($input, $isBinary); @@ -54,9 +55,8 @@ class FormatConverterTest extends AbstractTestCase * * @param string $expected Expected result given an input * @param string $input Input to convert - * - * @dataProvider providerIpToBinary */ + #[DataProvider('providerIpToBinary')] public function testIpToBinary(string $expected, string $input): void { $result = FormatConverter::ipToBinary($input); @@ -78,9 +78,8 @@ class FormatConverterTest extends AbstractTestCase * * @param string $expected Expected result given an input * @param string $input Input to convert - * - * @dataProvider providerIpToLong */ + #[DataProvider('providerIpToLong')] public function testIpToLong(string $expected, string $input): void { $result = FormatConverter::ipToLong($input); @@ -102,9 +101,8 @@ class FormatConverterTest extends AbstractTestCase * * @param string $expected Expected result given an input * @param string $input Input to convert - * - * @dataProvider providerLongToIp */ + #[DataProvider('providerLongToIp')] public function testLongToIp(string $expected, string $input): void { $result = FormatConverter::longToIp($input); diff --git a/test/classes/Utils/GisTest.php b/test/classes/Utils/GisTest.php index f5a14c4df2..ea2c83d146 100644 --- a/test/classes/Utils/GisTest.php +++ b/test/classes/Utils/GisTest.php @@ -8,10 +8,12 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; use PhpMyAdmin\Utils\Gis; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use function hex2bin; -/** @covers \PhpMyAdmin\Utils\Gis */ +#[CoversClass(Gis::class)] class GisTest extends AbstractTestCase { protected function setUp(): void @@ -26,9 +28,8 @@ class GisTest extends AbstractTestCase * @param mixed[] $returnData The data to return for fetchRow * @param bool $SRIDOption Use the SRID option or not * @param int $mysqlVersion The mysql version to return for getVersion - * - * @dataProvider providerConvertToWellKnownText */ + #[DataProvider('providerConvertToWellKnownText')] public function testConvertToWellKnownText( string $expectedQuery, array $returnData, diff --git a/test/classes/Utils/HttpRequestTest.php b/test/classes/Utils/HttpRequestTest.php index 69612bffd2..cd3ae00ca1 100644 --- a/test/classes/Utils/HttpRequestTest.php +++ b/test/classes/Utils/HttpRequestTest.php @@ -6,6 +6,10 @@ namespace PhpMyAdmin\Tests\Utils; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Utils\HttpRequest; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use function curl_version; use function ini_get; @@ -14,7 +18,7 @@ use function stripos; use const CURLOPT_CAINFO; use const CURLOPT_CAPATH; -/** @covers \PhpMyAdmin\Utils\HttpRequest */ +#[CoversClass(HttpRequest::class)] class HttpRequestTest extends AbstractTestCase { private HttpRequest $httpRequest; @@ -57,12 +61,11 @@ class HttpRequestTest extends AbstractTestCase * @param string $method method * @param bool $returnOnlyStatus return only status * @param bool|string|null $expected expected result - * - * @group medium - * @dataProvider httpRequests - * @group network - * @requires extension curl */ + #[DataProvider('httpRequests')] + #[Group('medium')] + #[Group('network')] + #[RequiresPhpExtension('curl')] public function testCurl(string $url, string $method, bool $returnOnlyStatus, bool|string|null $expected): void { $result = $this->callFunction( @@ -81,12 +84,11 @@ class HttpRequestTest extends AbstractTestCase * @param string $method method * @param bool $returnOnlyStatus return only status * @param bool|string|null $expected expected result - * - * @group medium - * @dataProvider httpRequests - * @group network - * @requires extension curl */ + #[DataProvider('httpRequests')] + #[Group('medium')] + #[Group('network')] + #[RequiresPhpExtension('curl')] public function testCurlCAPath( string $url, string $method, @@ -112,12 +114,11 @@ class HttpRequestTest extends AbstractTestCase * @param string $method method * @param bool $returnOnlyStatus return only status * @param bool|string|null $expected expected result - * - * @group medium - * @dataProvider httpRequests - * @group network - * @requires extension curl */ + #[DataProvider('httpRequests')] + #[Group('medium')] + #[Group('network')] + #[RequiresPhpExtension('curl')] public function testCurlCAInfo( string $url, string $method, @@ -143,11 +144,10 @@ class HttpRequestTest extends AbstractTestCase * @param string $method method * @param bool $returnOnlyStatus return only status * @param bool|string|null $expected expected result - * - * @group medium - * @dataProvider httpRequests - * @group network */ + #[DataProvider('httpRequests')] + #[Group('medium')] + #[Group('network')] public function testFopen(string $url, string $method, bool $returnOnlyStatus, bool|string|null $expected): void { if (! ini_get('allow_url_fopen')) { @@ -170,12 +170,11 @@ class HttpRequestTest extends AbstractTestCase * @param string $method method * @param bool $returnOnlyStatus return only status * @param bool|string|null $expected expected result - * - * @group medium - * @dataProvider httpRequests - * @group network - * @requires extension curl */ + #[DataProvider('httpRequests')] + #[Group('medium')] + #[Group('network')] + #[RequiresPhpExtension('curl')] public function testCreate(string $url, string $method, bool $returnOnlyStatus, bool|string|null $expected): void { if (! ini_get('allow_url_fopen')) { diff --git a/test/classes/Utils/SessionCacheTest.php b/test/classes/Utils/SessionCacheTest.php index 3db5c67a94..7d5b42a4c4 100644 --- a/test/classes/Utils/SessionCacheTest.php +++ b/test/classes/Utils/SessionCacheTest.php @@ -5,9 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Utils; use PhpMyAdmin\Utils\SessionCache; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** @covers \PhpMyAdmin\Utils\SessionCache */ +#[CoversClass(SessionCache::class)] class SessionCacheTest extends TestCase { public function testGet(): void diff --git a/test/classes/VersionInformationTest.php b/test/classes/VersionInformationTest.php index f75dc3ef71..b29e9778b8 100644 --- a/test/classes/VersionInformationTest.php +++ b/test/classes/VersionInformationTest.php @@ -5,9 +5,12 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\VersionInformation; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use stdClass; -/** @covers \PhpMyAdmin\VersionInformation */ +#[CoversClass(VersionInformation::class)] class VersionInformationTest extends AbstractTestCase { /** @var stdClass[] */ @@ -51,10 +54,9 @@ class VersionInformationTest extends AbstractTestCase /** * Test version checking - * - * @group large - * @group network */ + #[Group('large')] + #[Group('network')] public function testGetLatestVersion(): void { $this->setProxySettings(); @@ -72,9 +74,8 @@ class VersionInformationTest extends AbstractTestCase * * @param string $version Version string * @param int $numeric Integer matching version - * - * @dataProvider dataVersions */ + #[DataProvider('dataVersions')] public function testVersionToInt(string $version, int $numeric): void { $versionInformation = new VersionInformation(); @@ -168,9 +169,8 @@ class VersionInformationTest extends AbstractTestCase * @param list $versions The versions to use * @param array{int, string} $conditions The conditions that will be executed * @param string|null $matchedLastVersion The version that will be matched - * - * @dataProvider dataProviderVersionConditions */ + #[DataProvider('dataProviderVersionConditions')] public function testGetLatestCompatibleVersionWithNewPHPVersion( array $versions, array $conditions, diff --git a/test/classes/VersionTest.php b/test/classes/VersionTest.php index 6d8fdc2d8d..414fd218a1 100644 --- a/test/classes/VersionTest.php +++ b/test/classes/VersionTest.php @@ -5,10 +5,11 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\Version; +use PHPUnit\Framework\Attributes\CoversClass; use function defined; -/** @covers \PhpMyAdmin\Version */ +#[CoversClass(Version::class)] class VersionTest extends AbstractTestCase { /** diff --git a/test/classes/WebAuthn/CBORDecoderTest.php b/test/classes/WebAuthn/CBORDecoderTest.php index c941a2d974..1848501d89 100644 --- a/test/classes/WebAuthn/CBORDecoderTest.php +++ b/test/classes/WebAuthn/CBORDecoderTest.php @@ -7,6 +7,8 @@ namespace PhpMyAdmin\Tests\WebAuthn; use PhpMyAdmin\WebAuthn\CBORDecoder; use PhpMyAdmin\WebAuthn\DataStream; use PhpMyAdmin\WebAuthn\WebAuthnException; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function base64_decode; @@ -14,13 +16,11 @@ use function hex2bin; use const INF; -/** - * @covers \PhpMyAdmin\WebAuthn\CBORDecoder - * @covers \PhpMyAdmin\WebAuthn\DataStream - */ +#[CoversClass(CBORDecoder::class)] +#[CoversClass(DataStream::class)] class CBORDecoderTest extends TestCase { - /** @dataProvider dataProviderForTestDecode */ + #[DataProvider('dataProviderForTestDecode')] public function testDecode(string $encoded, mixed $expected): void { $decoder = new CBORDecoder(); @@ -154,7 +154,7 @@ class CBORDecoderTest extends TestCase } } - /** @dataProvider indefiniteLengthValuesProvider */ + #[DataProvider('indefiniteLengthValuesProvider')] public function testDecodeForNotSupportedValues(string $encoded): void { $decoder = new CBORDecoder(); diff --git a/test/classes/WebAuthn/WebauthnLibServerTest.php b/test/classes/WebAuthn/WebauthnLibServerTest.php index 75992a78e2..5a035a5d18 100644 --- a/test/classes/WebAuthn/WebauthnLibServerTest.php +++ b/test/classes/WebAuthn/WebauthnLibServerTest.php @@ -6,13 +6,14 @@ namespace PhpMyAdmin\Tests\WebAuthn; use PhpMyAdmin\TwoFactor; use PhpMyAdmin\WebAuthn\WebauthnLibServer; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Webauthn\Server as WebauthnServer; use function base64_encode; use function class_exists; -/** @covers \PhpMyAdmin\WebAuthn\WebauthnLibServer */ +#[CoversClass(WebauthnLibServer::class)] class WebauthnLibServerTest extends TestCase { protected function setUp(): void diff --git a/test/classes/ZipExtensionTest.php b/test/classes/ZipExtensionTest.php index 4564753ba3..fad3935475 100644 --- a/test/classes/ZipExtensionTest.php +++ b/test/classes/ZipExtensionTest.php @@ -5,16 +5,17 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests; use PhpMyAdmin\ZipExtension; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use ZipArchive; use function file_put_contents; use function tempnam; use function unlink; -/** - * @covers \PhpMyAdmin\ZipExtension - * @requires extension zip - */ +#[CoversClass(ZipExtension::class)] +#[RequiresPhpExtension('zip')] class ZipExtensionTest extends AbstractTestCase { private ZipExtension $zipExtension; @@ -33,9 +34,8 @@ class ZipExtensionTest extends AbstractTestCase * @param string|null $specificEntry regular expression to match a file * @param array $output expected output * @psalm-param array{error: string, data: string} $output - * - * @dataProvider provideTestGetContents */ + #[DataProvider('provideTestGetContents')] public function testGetContents(string $file, string|null $specificEntry, array $output): void { $this->assertEquals( @@ -76,9 +76,8 @@ class ZipExtensionTest extends AbstractTestCase * @param string $fileRegexp regular expression for the file name to match * @param string|bool $output expected output * @psalm-param string|false $output - * - * @dataProvider provideTestFindFile */ + #[DataProvider('provideTestFindFile')] public function testFindFile(string $file, string $fileRegexp, string|bool $output): void { $this->assertEquals( diff --git a/test/selenium/ChangePasswordTest.php b/test/selenium/ChangePasswordTest.php index 8174a77cd8..be4f62a1c1 100644 --- a/test/selenium/ChangePasswordTest.php +++ b/test/selenium/ChangePasswordTest.php @@ -4,9 +4,12 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; + use function trim; -/** @coversNothing */ +#[CoversNothing] class ChangePasswordTest extends TestBase { /** @@ -16,9 +19,8 @@ class ChangePasswordTest extends TestBase /** * Tests the changing of the password - * - * @group large */ + #[Group('large')] public function testChangePassword(): void { $this->login(); diff --git a/test/selenium/CreateDropDatabaseTest.php b/test/selenium/CreateDropDatabaseTest.php index 072de65e66..1065502a69 100644 --- a/test/selenium/CreateDropDatabaseTest.php +++ b/test/selenium/CreateDropDatabaseTest.php @@ -4,7 +4,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; -/** @coversNothing */ +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; + +#[CoversNothing] class CreateDropDatabaseTest extends TestBase { /** @@ -21,9 +24,8 @@ class CreateDropDatabaseTest extends TestBase /** * Creates a database and drops it - * - * @group large */ + #[Group('large')] public function testCreateDropDatabase(): void { $this->dbQuery('DROP DATABASE IF EXISTS `' . $this->databaseName . '`;'); diff --git a/test/selenium/CreateRemoveUserTest.php b/test/selenium/CreateRemoveUserTest.php index e7a35fcde3..bfbe603b29 100644 --- a/test/selenium/CreateRemoveUserTest.php +++ b/test/selenium/CreateRemoveUserTest.php @@ -4,10 +4,13 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; + use function bin2hex; use function random_bytes; -/** @coversNothing */ +#[CoversNothing] class CreateRemoveUserTest extends TestBase { /** @@ -40,9 +43,8 @@ class CreateRemoveUserTest extends TestBase /** * Creates and removes a user - * - * @group large */ + #[Group('large')] public function testCreateRemoveUser(): void { $this->waitForElement('partialLinkText', 'User accounts')->click(); diff --git a/test/selenium/Database/EventsTest.php b/test/selenium/Database/EventsTest.php index fdfd30cbcd..61eac5bdec 100644 --- a/test/selenium/Database/EventsTest.php +++ b/test/selenium/Database/EventsTest.php @@ -5,12 +5,15 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium\Database; use PhpMyAdmin\Tests\Selenium\TestBase; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Depends; +use PHPUnit\Framework\Attributes\Group; use function date; use function sleep; use function strtotime; -/** @coversNothing */ +#[CoversNothing] class EventsTest extends TestBase { /** @@ -72,9 +75,8 @@ class EventsTest extends TestBase /** * Create an event - * - * @group large */ + #[Group('large')] public function testAddEvent(): void { $this->waitForElement('partialLinkText', 'Events')->click(); @@ -154,10 +156,9 @@ class EventsTest extends TestBase /** * Test for editing events - * - * @depends testAddEvent - * @group large */ + #[Depends('testAddEvent')] + #[Group('large')] public function testEditEvents(): void { $this->eventSQL(); @@ -190,10 +191,9 @@ class EventsTest extends TestBase /** * Test for dropping event - * - * @depends testAddEvent - * @group large */ + #[Depends('testAddEvent')] + #[Group('large')] public function testDropEvent(): void { $this->eventSQL(); diff --git a/test/selenium/Database/OperationsTest.php b/test/selenium/Database/OperationsTest.php index ec0e549ea7..dc87ef2350 100644 --- a/test/selenium/Database/OperationsTest.php +++ b/test/selenium/Database/OperationsTest.php @@ -5,8 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium\Database; use PhpMyAdmin\Tests\Selenium\TestBase; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; -/** @coversNothing */ +#[CoversNothing] class OperationsTest extends TestBase { /** @@ -31,9 +33,8 @@ class OperationsTest extends TestBase /** * Test for adding database comment - * - * @group large */ + #[Group('large')] public function testDbComment(): void { $this->skipIfNotPMADB(); @@ -52,9 +53,8 @@ class OperationsTest extends TestBase /** * Test for renaming database - * - * @group large */ + #[Group('large')] public function testRenameDB(): void { $this->getToDBOperations(); @@ -91,9 +91,8 @@ class OperationsTest extends TestBase /** * Test for copying database - * - * @group large */ + #[Group('large')] public function testCopyDb(): void { $this->getToDBOperations(); diff --git a/test/selenium/Database/ProceduresTest.php b/test/selenium/Database/ProceduresTest.php index 9415128c5c..e2ae76922a 100644 --- a/test/selenium/Database/ProceduresTest.php +++ b/test/selenium/Database/ProceduresTest.php @@ -5,11 +5,13 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium\Database; use PhpMyAdmin\Tests\Selenium\TestBase; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; use function sleep; use function str_replace; -/** @coversNothing */ +#[CoversNothing] class ProceduresTest extends TestBase { /** @@ -105,9 +107,8 @@ class ProceduresTest extends TestBase /** * Create a procedure - * - * @group large */ + #[Group('large')] public function testAddProcedure(): void { $this->waitForElement('partialLinkText', 'Routines')->click(); @@ -161,9 +162,8 @@ class ProceduresTest extends TestBase /** * Test for editing procedure - * - * @group large */ + #[Group('large')] public function testEditProcedure(): void { $this->procedureSQL(); @@ -187,9 +187,8 @@ class ProceduresTest extends TestBase /** * Test for dropping procedure - * - * @group large */ + #[Group('large')] public function testDropProcedure(): void { $this->procedureSQL(); diff --git a/test/selenium/Database/StructureTest.php b/test/selenium/Database/StructureTest.php index 5dfcc51f62..ec2854dc7f 100644 --- a/test/selenium/Database/StructureTest.php +++ b/test/selenium/Database/StructureTest.php @@ -5,8 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium\Database; use PhpMyAdmin\Tests\Selenium\TestBase; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; -/** @coversNothing */ +#[CoversNothing] class StructureTest extends TestBase { /** @@ -41,9 +43,8 @@ class StructureTest extends TestBase /** * Test for truncating a table - * - * @group large */ + #[Group('large')] public function testTruncateTable(): void { $this->byXPath("(//a[contains(., 'Empty')])[1]")->click(); @@ -65,9 +66,8 @@ class StructureTest extends TestBase /** * Tests for dropping multiple tables - * - * @group large */ + #[Group('large')] public function testDropMultipleTables(): void { $this->byCssSelector("label[for='tablesForm_checkall']")->click(); diff --git a/test/selenium/ExportTest.php b/test/selenium/ExportTest.php index 7a5d7de72b..0e961542b6 100644 --- a/test/selenium/ExportTest.php +++ b/test/selenium/ExportTest.php @@ -4,9 +4,13 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; + use function strtolower; -/** @coversNothing */ +#[CoversNothing] class ExportTest extends TestBase { /** @@ -34,10 +38,9 @@ class ExportTest extends TestBase * * @param string $plugin Export format * @param string[] $expected Array of expected strings - * - * @dataProvider exportDataProvider - * @group large */ + #[DataProvider('exportDataProvider')] + #[Group('large')] public function testServerExport(string $plugin, array $expected): void { $text = $this->doExport('server', $plugin); @@ -52,10 +55,9 @@ class ExportTest extends TestBase * * @param string $plugin Export format * @param string[] $expected Array of expected strings - * - * @dataProvider exportDataProvider - * @group large */ + #[DataProvider('exportDataProvider')] + #[Group('large')] public function testDbExport(string $plugin, array $expected): void { $this->navigateDatabase($this->databaseName); @@ -72,10 +74,9 @@ class ExportTest extends TestBase * * @param string $plugin Export format * @param string[] $expected Array of expected strings - * - * @dataProvider exportDataProvider - * @group large */ + #[DataProvider('exportDataProvider')] + #[Group('large')] public function testTableExport(string $plugin, array $expected): void { $this->dbQuery('INSERT INTO `' . $this->databaseName . '`.`test_table` (val) VALUES (3);'); diff --git a/test/selenium/ImportTest.php b/test/selenium/ImportTest.php index 2f6309b9c0..d6a36ed6d3 100644 --- a/test/selenium/ImportTest.php +++ b/test/selenium/ImportTest.php @@ -4,7 +4,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; -/** @coversNothing */ +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; + +#[CoversNothing] class ImportTest extends TestBase { /** @@ -19,9 +22,8 @@ class ImportTest extends TestBase /** * Test for server level import - * - * @group large */ + #[Group('large')] public function testServerImport(): void { $this->doImport('server'); @@ -39,9 +41,8 @@ class ImportTest extends TestBase /** * Test for db level import - * - * @group large */ + #[Group('large')] public function testDbImport(): void { $this->dbQuery('CREATE DATABASE IF NOT EXISTS `' . $this->databaseName . '`'); @@ -61,9 +62,8 @@ class ImportTest extends TestBase /** * Test for table level import - * - * @group large */ + #[Group('large')] public function testTableImport(): void { // setup the db diff --git a/test/selenium/LoginTest.php b/test/selenium/LoginTest.php index 769a057951..7816dad72a 100644 --- a/test/selenium/LoginTest.php +++ b/test/selenium/LoginTest.php @@ -4,7 +4,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; -/** @coversNothing */ +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; + +#[CoversNothing] class LoginTest extends TestBase { /** @@ -21,9 +24,8 @@ class LoginTest extends TestBase /** * Test for successful login - * - * @group large */ + #[Group('large')] public function testSuccessfulLogin(): void { $this->login(); @@ -34,9 +36,8 @@ class LoginTest extends TestBase /** * Test for unsuccessful login - * - * @group large */ + #[Group('large')] public function testLoginWithWrongPassword(): void { $this->login('Admin', 'Admin'); diff --git a/test/selenium/NormalizationTest.php b/test/selenium/NormalizationTest.php index 596cbf6099..711ffc3780 100644 --- a/test/selenium/NormalizationTest.php +++ b/test/selenium/NormalizationTest.php @@ -4,7 +4,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; -/** @coversNothing */ +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; + +#[CoversNothing] class NormalizationTest extends TestBase { /** @@ -37,9 +40,8 @@ class NormalizationTest extends TestBase /** * Test for normalization to 1NF - * - * @group large */ + #[Group('large')] public function testNormalizationTo1NF(): void { $this->assertTrue( diff --git a/test/selenium/ServerSettingsTest.php b/test/selenium/ServerSettingsTest.php index 22c7b5ac3e..1ade87f977 100644 --- a/test/selenium/ServerSettingsTest.php +++ b/test/selenium/ServerSettingsTest.php @@ -4,9 +4,12 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; + use function sleep; -/** @coversNothing */ +#[CoversNothing] class ServerSettingsTest extends TestBase { /** @@ -48,9 +51,8 @@ class ServerSettingsTest extends TestBase /** * Tests whether hiding a database works or not - * - * @group large */ + #[Group('large')] public function testHideDatabase(): void { $this->createDatabase(); @@ -80,9 +82,8 @@ class ServerSettingsTest extends TestBase /** * Tests whether the various settings tabs are displayed when clicked - * - * @group large */ + #[Group('large')] public function testSettingsTabsAreDisplayed(): void { $this->byPartialLinkText('SQL queries')->click(); @@ -109,9 +110,8 @@ class ServerSettingsTest extends TestBase /** * Tests if hiding the logo works or not - * - * @group large */ + #[Group('large')] public function testHideLogo(): void { $this->byPartialLinkText('Navigation panel')->click(); diff --git a/test/selenium/SqlQueryTest.php b/test/selenium/SqlQueryTest.php index 24eab85ea5..1786d6fd99 100644 --- a/test/selenium/SqlQueryTest.php +++ b/test/selenium/SqlQueryTest.php @@ -4,7 +4,9 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; -/** @coversNothing */ +use PHPUnit\Framework\Attributes\CoversNothing; + +#[CoversNothing] class SqlQueryTest extends TestBase { /** diff --git a/test/selenium/Table/BrowseTest.php b/test/selenium/Table/BrowseTest.php index c1bbe67306..0d63b276dd 100644 --- a/test/selenium/Table/BrowseTest.php +++ b/test/selenium/Table/BrowseTest.php @@ -6,8 +6,10 @@ namespace PhpMyAdmin\Tests\Selenium\Table; use Facebook\WebDriver\WebDriverKeys; use PhpMyAdmin\Tests\Selenium\TestBase; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; -/** @coversNothing */ +#[CoversNothing] class BrowseTest extends TestBase { /** @@ -39,9 +41,8 @@ class BrowseTest extends TestBase /** * Test sorting of records in browse table - * - * @group large */ + #[Group('large')] public function testSortRecords(): void { // case 1 @@ -124,9 +125,8 @@ class BrowseTest extends TestBase /** * Test Edit Record - * - * @group large */ + #[Group('large')] public function testChangeRecords(): void { $ele = $this->byCssSelector('table.table_results tbody tr:nth-child(2) td:nth-child(2)'); @@ -180,9 +180,8 @@ class BrowseTest extends TestBase /** * Test edit record by double click - * - * @group large */ + #[Group('large')] public function testChangeRecordsByDoubleClick(): void { $element = $this->byCssSelector('table.table_results tbody tr:nth-child(1) td:nth-child(6)'); @@ -215,9 +214,8 @@ class BrowseTest extends TestBase /** * Test copy and insert record - * - * @group large */ + #[Group('large')] public function testCopyRecords(): void { $ele = $this->byCssSelector('table.table_results tbody tr:nth-child(3) td:nth-child(3)'); @@ -260,9 +258,8 @@ class BrowseTest extends TestBase /** * Test search table - * - * @group large */ + #[Group('large')] public function testSearchRecords(): void { $this->expandMore(); @@ -298,9 +295,8 @@ class BrowseTest extends TestBase /** * Test delete multiple records - * - * @group large */ + #[Group('large')] public function testDeleteRecords(): void { $this->byId('id_rows_to_delete1_left')->click(); diff --git a/test/selenium/Table/CreateTest.php b/test/selenium/Table/CreateTest.php index 9bedc691f3..ceb06bad6f 100644 --- a/test/selenium/Table/CreateTest.php +++ b/test/selenium/Table/CreateTest.php @@ -5,10 +5,12 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium\Table; use PhpMyAdmin\Tests\Selenium\TestBase; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; use function sleep; -/** @coversNothing */ +#[CoversNothing] class CreateTest extends TestBase { protected function setUp(): void @@ -21,9 +23,8 @@ class CreateTest extends TestBase /** * Creates a table - * - * @group large */ + #[Group('large')] public function testCreateTable(): void { $this->waitAjax(); diff --git a/test/selenium/Table/InsertTest.php b/test/selenium/Table/InsertTest.php index ad28380a1c..ccb3ba5783 100644 --- a/test/selenium/Table/InsertTest.php +++ b/test/selenium/Table/InsertTest.php @@ -5,8 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium\Table; use PhpMyAdmin\Tests\Selenium\TestBase; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; -/** @coversNothing */ +#[CoversNothing] class InsertTest extends TestBase { /** @@ -33,9 +35,8 @@ class InsertTest extends TestBase /** * Insert data into table - * - * @group large */ + #[Group('large')] public function testAddData(): void { if ($this->isSafari()) { diff --git a/test/selenium/Table/OperationsTest.php b/test/selenium/Table/OperationsTest.php index cdff555e36..dc08c4971e 100644 --- a/test/selenium/Table/OperationsTest.php +++ b/test/selenium/Table/OperationsTest.php @@ -5,8 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium\Table; use PhpMyAdmin\Tests\Selenium\TestBase; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; -/** @coversNothing */ +#[CoversNothing] class OperationsTest extends TestBase { /** @@ -46,9 +48,8 @@ class OperationsTest extends TestBase /** * Test for changing a table order - * - * @group large */ + #[Group('large')] public function testChangeTableOrder(): void { $this->selectByLabel( @@ -77,9 +78,8 @@ class OperationsTest extends TestBase /** * Test for moving a table - * - * @group large */ + #[Group('large')] public function testMoveTable(): void { $this->byCssSelector("form#moveTableForm input[name='new_name']") @@ -107,9 +107,8 @@ class OperationsTest extends TestBase /** * Test for renaming a table - * - * @group large */ + #[Group('large')] public function testRenameTable(): void { $this->byCssSelector("form#tableOptionsForm input[name='new_name']") @@ -137,9 +136,8 @@ class OperationsTest extends TestBase /** * Test for copying a table - * - * @group large */ + #[Group('large')] public function testCopyTable(): void { $this->scrollIntoView('copyTable'); @@ -167,9 +165,8 @@ class OperationsTest extends TestBase /** * Test for truncating a table - * - * @group large */ + #[Group('large')] public function testTruncateTable(): void { $this->scrollToBottom(); @@ -192,9 +189,8 @@ class OperationsTest extends TestBase /** * Test for dropping a table - * - * @group large */ + #[Group('large')] public function testDropTable(): void { $dropLink = $this->waitUntilElementIsVisible('partialLinkText', 'Delete the table (DROP)', 30); diff --git a/test/selenium/Table/StructureTest.php b/test/selenium/Table/StructureTest.php index c7f0a0d28b..4cd38bcab1 100644 --- a/test/selenium/Table/StructureTest.php +++ b/test/selenium/Table/StructureTest.php @@ -5,8 +5,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium\Table; use PhpMyAdmin\Tests\Selenium\TestBase; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; -/** @coversNothing */ +#[CoversNothing] class StructureTest extends TestBase { /** @@ -37,9 +39,8 @@ class StructureTest extends TestBase /** * Test for adding a new column - * - * @group large */ + #[Group('large')] public function testAddColumn(): void { $this->waitForElement('cssSelector', "#addColumns > input[value='Go']")->click(); @@ -69,9 +70,8 @@ class StructureTest extends TestBase /** * Test for changing a column - * - * @group large */ + #[Group('large')] public function testChangeColumn(): void { $this->byCssSelector('#tablestructure tbody tr:nth-child(2) td:nth-child(11)')->click(); @@ -97,9 +97,8 @@ class StructureTest extends TestBase /** * Test for dropping columns - * - * @group large */ + #[Group('large')] public function testDropColumns(): void { $this->waitForElement('cssSelector', 'label[for=checkbox_row_2]')->click(); diff --git a/test/selenium/TrackingTest.php b/test/selenium/TrackingTest.php index b61024f047..accb2afcb6 100644 --- a/test/selenium/TrackingTest.php +++ b/test/selenium/TrackingTest.php @@ -4,7 +4,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; -/** @coversNothing */ +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; + +#[CoversNothing] class TrackingTest extends TestBase { /** @@ -49,9 +52,8 @@ class TrackingTest extends TestBase /** * Tests basic tracking functionality - * - * @group large */ + #[Group('large')] public function testTrackingData(): void { $this->executeSqlAndReturnToTableTracking(); @@ -124,9 +126,8 @@ class TrackingTest extends TestBase /** * Tests deactivation of tracking - * - * @group large */ + #[Group('large')] public function testDeactivateTracking(): void { $this->byCssSelector("input[value='Deactivate now']")->click(); @@ -139,9 +140,8 @@ class TrackingTest extends TestBase /** * Tests dropping a tracking - * - * @group large */ + #[Group('large')] public function testDropTracking(): void { $this->navigateDatabase($this->databaseName, true); @@ -182,9 +182,8 @@ class TrackingTest extends TestBase /** * Tests structure snapshot of a tracking - * - * @group large */ + #[Group('large')] public function testStructureSnapshot(): void { $this->byPartialLinkText('Structure snapshot')->click(); diff --git a/test/selenium/TriggersTest.php b/test/selenium/TriggersTest.php index dbaea9d442..3b2b370da9 100644 --- a/test/selenium/TriggersTest.php +++ b/test/selenium/TriggersTest.php @@ -4,7 +4,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; -/** @coversNothing */ +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; + +#[CoversNothing] class TriggersTest extends TestBase { /** @@ -55,9 +58,8 @@ class TriggersTest extends TestBase /** * Create a Trigger - * - * @group large */ + #[Group('large')] public function testAddTrigger(): void { $this->expandMore(); @@ -123,9 +125,8 @@ class TriggersTest extends TestBase /** * Test for editing Triggers - * - * @group large */ + #[Group('large')] public function testEditTriggers(): void { $this->expandMore(); @@ -161,9 +162,8 @@ class TriggersTest extends TestBase /** * Test for dropping Trigger - * - * @group large */ + #[Group('large')] public function testDropTrigger(): void { $this->expandMore(); diff --git a/test/selenium/XssTest.php b/test/selenium/XssTest.php index 8b798774a7..f6cb582a6f 100644 --- a/test/selenium/XssTest.php +++ b/test/selenium/XssTest.php @@ -4,7 +4,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; -/** @coversNothing */ +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; + +#[CoversNothing] class XssTest extends TestBase { /** @@ -21,9 +24,8 @@ class XssTest extends TestBase /** * Tests the SQL query tab with a null query - * - * @group large */ + #[Group('large')] public function testQueryTabWithNullValue(): void { if ($this->isSafari()) {