Skip to content

Commit 01ce6af

Browse files
committed
Fix PHPUnit deprecations
1 parent fee11a8 commit 01ce6af

31 files changed

+76
-106
lines changed

phpunit.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
colors="true"
66
processIsolation="false"
77
stopOnFailure="false"
8-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
8+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
99
cacheDirectory=".phpunit.cache"
1010
backupStaticProperties="false">
11-
<coverage>
11+
<source>
1212
<include>
1313
<directory suffix=".php">./app</directory>
1414
</include>
15-
</coverage>
15+
</source>
1616
<testsuites>
1717
<testsuite name="Unit">
1818
<directory suffix="Test.php">./tests/Unit</directory>

rector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
declare(strict_types=1);
33

44
use Rector\Config\RectorConfig;
5+
use Rector\PHPUnit\Set\PHPUnitSetList;
56
use RectorLaravel\Set\LaravelLevelSetList;
67

78
return RectorConfig::configure()
89
// register single rule
910
->withSets([
1011
LaravelLevelSetList::UP_TO_LARAVEL_110,
12+
PHPUnitSetList::PHPUNIT_120,
13+
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
1114
]);

tests/Feature/I18n/AutoTranslator/SpaceAfterPeriodFixerTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
namespace Tests\Feature\I18n\AutoTranslator;
55

66
use amcsi\LyceeOverture\I18n\AutoTranslator\SpaceAfterPeriodFixer;
7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use PHPUnit\Framework\TestCase;
89

910
class SpaceAfterPeriodFixerTest extends TestCase
1011
{
1112

12-
/**
13-
* @dataProvider provideFix
14-
*/
13+
#[DataProvider('provideFix')]
1514
public function testFix($expected, $input)
1615
{
1716
self::assertSame($expected, SpaceAfterPeriodFixer::fix($input));

tests/I18n/Unit/Tools/JapaneseSentenceSplitterTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
namespace Tests\I18n\Unit\Tools;
55

66
use amcsi\LyceeOverture\I18n\Tools\JapaneseSentenceSplitter;
7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use PHPUnit\Framework\TestCase;
89

910
class JapaneseSentenceSplitterTest extends TestCase
1011
{
1112

12-
/**
13-
* @dataProvider provideReplace
14-
*/
13+
#[DataProvider('provideReplace')]
1514
public function testReplaceCallback(string $expected, string $input)
1615
{
17-
self::assertSame($expected, JapaneseSentenceSplitter::replaceCallback($input, static fn($match) => $match[0] . '¤'));
16+
self::assertSame($expected,
17+
JapaneseSentenceSplitter::replaceCallback($input, static fn($match) => $match[0].'¤'));
1818
}
1919

2020
public static function provideReplace()
@@ -23,7 +23,7 @@ public static function provideReplace()
2323
'simple' => ['hey¤', 'hey'],
2424
'line break' => ["hey\n¤yo¤", "hey\nyo"],
2525
'periods' => ["る。¤yo¤", "る。yo"],
26-
'period and line break' => ["る。¤\n¤", "る。\n"],
26+
'period and line break' => ["る。¤\n¤", "る。\n"],
2727
'periods and line breaks' => ["る。¤\n¤き。¤\n¤", "る。\nき。\n"],
2828
'periods in brackets' => ["[ペナルティ:[1枚ドローする。]]。¤る。¤", "[ペナルティ:[1枚ドローする。]]。る。"],
2929
];

tests/Tools/SetAutoCreatorStubber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
class SetAutoCreatorStubber
1111
{
1212
/**
13-
* @param Set|null $setModel Optional Set model override for mocking DB operations.
13+
* @param Set|null $setModel Optional Set model override for mocking DB operations.
1414
* @return SetAutoCreator
1515
*/
16-
public static function createInstanceWithSets(Set $setModel = null): SetAutoCreator
16+
public static function createInstanceWithSets(?Set $setModel = null): SetAutoCreator
1717
{
1818
$set = new Set();
1919
$set->id = 1;

tests/Unit/Etc/LackeyHasherTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
namespace Tests\Unit\Etc;
55

66
use amcsi\LyceeOverture\Etc\LackeyHasher;
7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use PHPUnit\Framework\TestCase;
89

910
class LackeyHasherTest extends TestCase
1011
{
11-
/**
12-
* @dataProvider provideFilesToHash
13-
*/
12+
#[DataProvider('provideFilesToHash')]
1413
public function testHashesCorrectly($expected, $filename): void
1514
{
1615
self::assertSame($expected, LackeyHasher::hashFile($filename));
@@ -19,10 +18,10 @@ public function testHashesCorrectly($expected, $filename): void
1918
public static function provideFilesToHash()
2019
{
2120
return [
22-
[350485, __DIR__ . '/350485.txt'],
23-
[372237, __DIR__ . '/372237.txt'],
24-
[-20265, __DIR__ . '/-20265.jpg'],
25-
[-8196, __DIR__ . '/-8196.jpg'],
21+
[350485, __DIR__.'/350485.txt'],
22+
[372237, __DIR__.'/372237.txt'],
23+
[-20265, __DIR__.'/-20265.jpg'],
24+
[-8196, __DIR__.'/-8196.jpg'],
2625
];
2726
}
2827
}

tests/Unit/I18n/AutoTranslator/CapitalizationFixerTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
namespace Tests\Unit\I18n\AutoTranslator;
55

66
use amcsi\LyceeOverture\I18n\AutoTranslator\CapitalizationFixer;
7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use PHPUnit\Framework\TestCase;
89

910
class CapitalizationFixerTest extends TestCase
1011
{
11-
/**
12-
* @dataProvider provideFixCapitalization
13-
*/
12+
#[DataProvider('provideFixCapitalization')]
1413
public function testFixCapitalization(string $expected, string $input)
1514
{
1615
self::assertSame($expected, CapitalizationFixer::fixCapitalization($input));

tests/Unit/I18n/AutoTranslator/DiscardFromDeckTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
namespace Tests\Unit\I18n\AutoTranslator;
55

66
use amcsi\LyceeOverture\I18n\AutoTranslator\DiscardFromDeck;
7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use PHPUnit\Framework\TestCase;
89

910
class DiscardFromDeckTest extends TestCase
1011
{
11-
/**
12-
* @dataProvider provideAutoTranslate
13-
*/
12+
#[DataProvider('provideAutoTranslate')]
1413
public function testAutoTranslate($expected, $input)
1514
{
1615
self::assertSame($expected, DiscardFromDeck::autoTranslate($input));

tests/Unit/I18n/AutoTranslator/DrawCardsTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
class DrawCardsTest extends TestCase
1010
{
11-
/**
12-
* @dataProvider provideAutoTranslate
13-
*/
11+
#[\PHPUnit\Framework\Attributes\DataProvider('provideAutoTranslate')]
1412
public function testAutoTranslate(string $expected, string $input)
1513
{
1614
self::assertSame($expected, DrawCards::autoTranslate($input));

tests/Unit/I18n/AutoTranslator/WhenAppearsTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
namespace Tests\Unit\I18n\AutoTranslator;
55

66
use amcsi\LyceeOverture\I18n\AutoTranslator\WhenAppears;
7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use PHPUnit\Framework\TestCase;
89

910
class WhenAppearsTest extends TestCase
1011
{
11-
/**
12-
* @dataProvider provideAutoTranslate
13-
*/
12+
#[DataProvider('provideAutoTranslate')]
1413
public function testAutoTranslate(string $expected, string $input)
1514
{
1615
self::assertSame($expected, WhenAppears::autoTranslate($input));

0 commit comments

Comments
 (0)