1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
|
From: =?utf-8?q?Maur=C3=ADcio_Meneghini_Fauth?= <mauricio@mfauth.net>
Date: Tue, 25 Feb 2025 16:31:26 -0300
Subject: Bump PHPUnit to version 11
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Origin: backport, https://github.com/phpmyadmin/motranslator/commit/edb5ee5cd170d86e6316c671b61aade696842c89
Forwarded: yes
---
composer.json | 2 +-
tests/Cache/ApcuCacheFactoryTest.php | 5 ++---
tests/Cache/ApcuCacheTest.php | 5 ++---
tests/Cache/InMemoryCacheTest.php | 5 ++---
tests/LoaderTest.php | 12 ++++--------
tests/MoFilesTest.php | 25 +++++++------------------
tests/PluralFormulaTest.php | 12 ++++--------
tests/PluralTest.php | 7 +++----
8 files changed, 25 insertions(+), 48 deletions(-)
diff --git a/composer.json b/composer.json
index 3ec88df..6db53bf 100644
--- a/composer.json
+++ b/composer.json
@@ -37,7 +37,7 @@
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-strict-rules": "^1.6",
- "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5"
+ "phpunit/phpunit": "^11.5"
},
"autoload": {
"psr-4": {
diff --git a/tests/Cache/ApcuCacheFactoryTest.php b/tests/Cache/ApcuCacheFactoryTest.php
index 53b16a8..debfda0 100644
--- a/tests/Cache/ApcuCacheFactoryTest.php
+++ b/tests/Cache/ApcuCacheFactoryTest.php
@@ -7,6 +7,7 @@ namespace PhpMyAdmin\MoTranslator\Tests\Cache;
use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
use PhpMyAdmin\MoTranslator\Cache\ApcuCacheFactory;
use PhpMyAdmin\MoTranslator\MoParser;
+use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use function apcu_clear_cache;
@@ -16,9 +17,7 @@ use function apcu_fetch;
use function function_exists;
use function sleep;
-/**
- * @covers \PhpMyAdmin\MoTranslator\Cache\ApcuCacheFactory
- */
+#[CoversClass(ApcuCacheFactory::class)]
class ApcuCacheFactoryTest extends TestCase
{
protected function setUp(): void
diff --git a/tests/Cache/ApcuCacheTest.php b/tests/Cache/ApcuCacheTest.php
index cc3be25..5aeb0bd 100644
--- a/tests/Cache/ApcuCacheTest.php
+++ b/tests/Cache/ApcuCacheTest.php
@@ -6,6 +6,7 @@ namespace PhpMyAdmin\MoTranslator\Tests\Cache;
use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
use PhpMyAdmin\MoTranslator\MoParser;
+use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use ReflectionMethod;
@@ -20,9 +21,7 @@ use function function_exists;
use function implode;
use function sleep;
-/**
- * @covers \PhpMyAdmin\MoTranslator\Cache\ApcuCache
- */
+#[CoversClass(ApcuCache::class)]
class ApcuCacheTest extends TestCase
{
protected function setUp(): void
diff --git a/tests/Cache/InMemoryCacheTest.php b/tests/Cache/InMemoryCacheTest.php
index 8047f92..003575d 100644
--- a/tests/Cache/InMemoryCacheTest.php
+++ b/tests/Cache/InMemoryCacheTest.php
@@ -6,11 +6,10 @@ namespace PhpMyAdmin\MoTranslator\Tests\Cache;
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
use PhpMyAdmin\MoTranslator\MoParser;
+use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
-/**
- * @covers \PhpMyAdmin\MoTranslator\Cache\InMemoryCache
- */
+#[CoversClass(InMemoryCache::class)]
class InMemoryCacheTest extends TestCase
{
public function testConstructorParsesCache(): void
diff --git a/tests/LoaderTest.php b/tests/LoaderTest.php
index 3eb16ec..efa585f 100644
--- a/tests/LoaderTest.php
+++ b/tests/LoaderTest.php
@@ -8,6 +8,7 @@ use PhpMyAdmin\MoTranslator\Cache\CacheFactoryInterface;
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
use PhpMyAdmin\MoTranslator\Loader;
use PhpMyAdmin\MoTranslator\MoParser;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
@@ -19,11 +20,8 @@ use function putenv;
*/
class LoaderTest extends TestCase
{
- /**
- * @param array[] $expected
- *
- * @dataProvider localeList
- */
+ /** @param list<string> $expected */
+ #[DataProvider('localeList')]
public function testListLocales(string $locale, array $expected): void
{
self::assertSame($expected, Loader::listLocales($locale));
@@ -156,9 +154,7 @@ class LoaderTest extends TestCase
self::assertSame('Тып', $translator->gettext('Type'));
}
- /**
- * @dataProvider translatorData
- */
+ #[DataProvider('translatorData')]
public function testGetTranslator(string $domain, string $locale, string $otherdomain, string $expected): void
{
$loader = $this->getLoader($domain, $locale);
diff --git a/tests/MoFilesTest.php b/tests/MoFilesTest.php
index 9cbcfc5..3ecae19 100644
--- a/tests/MoFilesTest.php
+++ b/tests/MoFilesTest.php
@@ -7,6 +7,7 @@ namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
use PhpMyAdmin\MoTranslator\MoParser;
use PhpMyAdmin\MoTranslator\Translator;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use function basename;
@@ -18,9 +19,7 @@ use function strpos;
*/
class MoFilesTest extends TestCase
{
- /**
- * @dataProvider provideMoFiles
- */
+ #[DataProvider('provideMoFiles')]
public function testMoFileTranslate(string $filename): void
{
$parser = $this->getTranslator($filename);
@@ -29,9 +28,7 @@ class MoFilesTest extends TestCase
self::assertSame('Column parser', $parser->gettext('Column parser'));
}
- /**
- * @dataProvider provideMoFiles
- */
+ #[DataProvider('provideMoFiles')]
public function testMoFilePlurals(string $filename): void
{
$parser = $this->getTranslator($filename);
@@ -54,18 +51,14 @@ class MoFilesTest extends TestCase
self::assertSame('"%d" seconds', $parser->ngettext('"%d" second', '"%d" seconds', 10));
}
- /**
- * @dataProvider provideMoFiles
- */
+ #[DataProvider('provideMoFiles')]
public function testMoFileContext(string $filename): void
{
$parser = $this->getTranslator($filename);
self::assertSame('Tabulka', $parser->pgettext('Display format', 'Table'));
}
- /**
- * @dataProvider provideNotTranslatedFiles
- */
+ #[DataProvider('provideNotTranslatedFiles')]
public function testMoFileNotTranslated(string $filename): void
{
$parser = $this->getTranslator($filename);
@@ -96,9 +89,7 @@ class MoFilesTest extends TestCase
return self::getFiles('./tests/data/not-translated/*.mo');
}
- /**
- * @dataProvider provideErrorMoFiles
- */
+ #[DataProvider('provideErrorMoFiles')]
public function testEmptyMoFile(string $file): void
{
$parser = new MoParser($file);
@@ -113,9 +104,7 @@ class MoFilesTest extends TestCase
self::assertSame('"%d" seconds', $translator->ngettext('"%d" second', '"%d" seconds', 10));
}
- /**
- * @dataProvider provideMoFiles
- */
+ #[DataProvider('provideMoFiles')]
public function testExists(string $file): void
{
$parser = $this->getTranslator($file);
diff --git a/tests/PluralFormulaTest.php b/tests/PluralFormulaTest.php
index 06f1261..06602de 100644
--- a/tests/PluralFormulaTest.php
+++ b/tests/PluralFormulaTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\Translator;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
/**
@@ -14,9 +15,8 @@ class PluralFormulaTest extends TestCase
{
/**
* Test for extractPluralsForms.
- *
- * @dataProvider pluralExtractionData
*/
+ #[DataProvider('pluralExtractionData')]
public function testExtractPluralsForms(string $header, string $expected): void
{
self::assertSame($expected, Translator::extractPluralsForms($header));
@@ -55,9 +55,7 @@ class PluralFormulaTest extends TestCase
];
}
- /**
- * @dataProvider pluralCounts
- */
+ #[DataProvider('pluralCounts')]
public function testPluralCounts(string $expr, int $expected): void
{
self::assertSame($expected, Translator::extractPluralCount($expr));
@@ -96,9 +94,7 @@ class PluralFormulaTest extends TestCase
];
}
- /**
- * @dataProvider pluralExpressions
- */
+ #[DataProvider('pluralExpressions')]
public function testPluralExpression(string $expr, string $expected): void
{
self::assertSame($expected, Translator::sanitizePluralExpression($expr));
diff --git a/tests/PluralTest.php b/tests/PluralTest.php
index 3651db4..ec28728 100644
--- a/tests/PluralTest.php
+++ b/tests/PluralTest.php
@@ -7,6 +7,7 @@ namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
use PhpMyAdmin\MoTranslator\MoParser;
use PhpMyAdmin\MoTranslator\Translator;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use function chr;
@@ -22,9 +23,8 @@ class PluralTest extends TestCase
*
* @param int $number Number
* @param string $expected Expected output
- *
- * @dataProvider providerTestNpgettext
*/
+ #[DataProvider('providerTestNpgettext')]
public function testNpgettext(int $number, string $expected): void
{
$parser = $this->getTranslator('');
@@ -90,9 +90,8 @@ class PluralTest extends TestCase
* Test for ngettext
*
* @see https://github.com/phpmyadmin/motranslator/issues/37
- *
- * @dataProvider dataProviderPluralForms
*/
+ #[DataProvider('dataProviderPluralForms')]
public function testNgettextSelectString(string $pluralForms): void
{
$parser = $this->getTranslator('');
|