Skip to content

Commit edb5ee5

Browse files
committed
Bump PHPUnit to version 11
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
1 parent cbcdd8f commit edb5ee5

File tree

9 files changed

+25
-30
lines changed

9 files changed

+25
-30
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"phpstan/phpstan-deprecation-rules": "^2.0",
3838
"phpstan/phpstan-phpunit": "^2.0",
3939
"phpstan/phpstan-strict-rules": "^2.0",
40-
"phpunit/phpunit": "^10.5",
40+
"phpunit/phpunit": "^11.5",
4141
"psalm/plugin-phpunit": "^0.19.2",
4242
"vimeo/psalm": "^6.8"
4343
},

phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,3 @@ parameters:
101101
identifier: staticMethod.dynamicCall
102102
count: 1
103103
path: tests/LoaderTest.php
104-
105-
-
106-
message: '#^Dynamic call to static method PHPUnit\\Framework\\TestCase\:\:once\(\)\.$#'
107-
identifier: staticMethod.dynamicCall
108-
count: 1
109-
path: tests/LoaderTest.php

tests/Cache/ApcuCacheFactoryTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
88
use PhpMyAdmin\MoTranslator\Cache\ApcuCacheFactory;
99
use PhpMyAdmin\MoTranslator\MoParser;
10+
use PHPUnit\Framework\Attributes\CoversClass;
1011
use PHPUnit\Framework\TestCase;
1112

1213
use function apcu_clear_cache;
@@ -16,7 +17,7 @@
1617
use function function_exists;
1718
use function sleep;
1819

19-
/** @covers \PhpMyAdmin\MoTranslator\Cache\ApcuCacheFactory */
20+
#[CoversClass(ApcuCacheFactory::class)]
2021
class ApcuCacheFactoryTest extends TestCase
2122
{
2223
protected function setUp(): void

tests/Cache/ApcuCacheTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
88
use PhpMyAdmin\MoTranslator\MoParser;
9+
use PHPUnit\Framework\Attributes\CoversClass;
910
use PHPUnit\Framework\TestCase;
1011
use ReflectionMethod;
1112

@@ -20,7 +21,7 @@
2021
use function implode;
2122
use function sleep;
2223

23-
/** @covers \PhpMyAdmin\MoTranslator\Cache\ApcuCache */
24+
#[CoversClass(ApcuCache::class)]
2425
class ApcuCacheTest extends TestCase
2526
{
2627
protected function setUp(): void

tests/Cache/InMemoryCacheTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
88
use PhpMyAdmin\MoTranslator\MoParser;
9+
use PHPUnit\Framework\Attributes\CoversClass;
910
use PHPUnit\Framework\TestCase;
1011

11-
/** @covers \PhpMyAdmin\MoTranslator\Cache\InMemoryCache */
12+
#[CoversClass(InMemoryCache::class)]
1213
class InMemoryCacheTest extends TestCase
1314
{
1415
public function testConstructorParsesCache(): void

tests/LoaderTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
99
use PhpMyAdmin\MoTranslator\Loader;
1010
use PhpMyAdmin\MoTranslator\MoParser;
11+
use PHPUnit\Framework\Attributes\DataProvider;
1112
use PHPUnit\Framework\MockObject\MockObject;
1213
use PHPUnit\Framework\TestCase;
1314

@@ -19,11 +20,8 @@
1920
*/
2021
class LoaderTest extends TestCase
2122
{
22-
/**
23-
* @param list<string> $expected
24-
*
25-
* @dataProvider localeList
26-
*/
23+
/** @param list<string> $expected */
24+
#[DataProvider('localeList')]
2725
public function testListLocales(string $locale, array $expected): void
2826
{
2927
self::assertSame($expected, Loader::listLocales($locale));
@@ -154,7 +152,7 @@ public function testLocaleChange(): void
154152
self::assertSame('Тып', $translator->gettext('Type'));
155153
}
156154

157-
/** @dataProvider translatorData */
155+
#[DataProvider('translatorData')]
158156
public function testGetTranslator(string $domain, string $locale, string $otherdomain, string $expected): void
159157
{
160158
$loader = $this->getLoader($domain, $locale);

tests/MoFilesTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
88
use PhpMyAdmin\MoTranslator\MoParser;
99
use PhpMyAdmin\MoTranslator\Translator;
10+
use PHPUnit\Framework\Attributes\DataProvider;
1011
use PHPUnit\Framework\TestCase;
1112

1213
use function basename;
@@ -18,7 +19,7 @@
1819
*/
1920
class MoFilesTest extends TestCase
2021
{
21-
/** @dataProvider provideMoFiles */
22+
#[DataProvider('provideMoFiles')]
2223
public function testMoFileTranslate(string $filename): void
2324
{
2425
$parser = $this->getTranslator($filename);
@@ -33,7 +34,7 @@ public function testMoFileTranslate(string $filename): void
3334
);
3435
}
3536

36-
/** @dataProvider provideMoFiles */
37+
#[DataProvider('provideMoFiles')]
3738
public function testMoFilePlurals(string $filename): void
3839
{
3940
$parser = $this->getTranslator($filename);
@@ -56,14 +57,14 @@ public function testMoFilePlurals(string $filename): void
5657
self::assertSame('"%d" seconds', $parser->ngettext('"%d" second', '"%d" seconds', 10));
5758
}
5859

59-
/** @dataProvider provideMoFiles */
60+
#[DataProvider('provideMoFiles')]
6061
public function testMoFileContext(string $filename): void
6162
{
6263
$parser = $this->getTranslator($filename);
6364
self::assertSame('Tabulka', $parser->pgettext('Display format', 'Table'));
6465
}
6566

66-
/** @dataProvider provideNotTranslatedFiles */
67+
#[DataProvider('provideNotTranslatedFiles')]
6768
public function testMoFileNotTranslated(string $filename): void
6869
{
6970
$parser = $this->getTranslator($filename);
@@ -88,7 +89,7 @@ public static function provideNotTranslatedFiles(): array
8889
return self::getFiles('./tests/data/not-translated/*.mo');
8990
}
9091

91-
/** @dataProvider provideErrorMoFiles */
92+
#[DataProvider('provideErrorMoFiles')]
9293
public function testEmptyMoFile(string $file): void
9394
{
9495
$parser = new MoParser($file);
@@ -103,7 +104,7 @@ public function testEmptyMoFile(string $file): void
103104
self::assertSame('"%d" seconds', $translator->ngettext('"%d" second', '"%d" seconds', 10));
104105
}
105106

106-
/** @dataProvider provideMoFiles */
107+
#[DataProvider('provideMoFiles')]
107108
public function testExists(string $file): void
108109
{
109110
$parser = $this->getTranslator($file);

tests/PluralFormulaTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace PhpMyAdmin\MoTranslator\Tests;
66

77
use PhpMyAdmin\MoTranslator\Translator;
8+
use PHPUnit\Framework\Attributes\DataProvider;
89
use PHPUnit\Framework\TestCase;
910

1011
/**
@@ -14,9 +15,8 @@ class PluralFormulaTest extends TestCase
1415
{
1516
/**
1617
* Test for extractPluralsForms.
17-
*
18-
* @dataProvider pluralExtractionData
1918
*/
19+
#[DataProvider('pluralExtractionData')]
2020
public function testExtractPluralsForms(string $header, string $expected): void
2121
{
2222
self::assertSame(
@@ -56,7 +56,7 @@ public static function pluralExtractionData(): array
5656
];
5757
}
5858

59-
/** @dataProvider pluralCounts */
59+
#[DataProvider('pluralCounts')]
6060
public function testPluralCounts(string $expr, int $expected): void
6161
{
6262
self::assertSame(
@@ -96,7 +96,7 @@ public static function pluralCounts(): array
9696
];
9797
}
9898

99-
/** @dataProvider pluralExpressions */
99+
#[DataProvider('pluralExpressions')]
100100
public function testPluralExpression(string $expr, string $expected): void
101101
{
102102
self::assertSame(

tests/PluralTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
88
use PhpMyAdmin\MoTranslator\MoParser;
99
use PhpMyAdmin\MoTranslator\Translator;
10+
use PHPUnit\Framework\Attributes\DataProvider;
1011
use PHPUnit\Framework\TestCase;
1112

1213
use function chr;
@@ -22,9 +23,8 @@ class PluralTest extends TestCase
2223
*
2324
* @param int $number Number
2425
* @param string $expected Expected output
25-
*
26-
* @dataProvider providerTestNpgettext
2726
*/
27+
#[DataProvider('providerTestNpgettext')]
2828
public function testNpgettext(int $number, string $expected): void
2929
{
3030
$parser = $this->getTranslator('');
@@ -88,9 +88,8 @@ public static function dataProviderPluralForms(): array
8888
* Test for ngettext
8989
*
9090
* @see https://github.com/phpmyadmin/motranslator/issues/37
91-
*
92-
* @dataProvider dataProviderPluralForms
9391
*/
92+
#[DataProvider('dataProviderPluralForms')]
9493
public function testNgettextSelectString(string $pluralForms): void
9594
{
9695
$parser = $this->getTranslator('');

0 commit comments

Comments
 (0)