Skip to content

Commit b52a815

Browse files
authored
Merge pull request #11 from samsonasik/upgrade-phpunit10
Upgrade phpunit10
2 parents a387403 + 4a419c1 commit b52a815

File tree

7 files changed

+33
-52
lines changed

7 files changed

+33
-52
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
/.php_cs.cache
66
/.vscode/
77
/build/logs/*
8-
/.phpunit.result.cache
8+
/.phpunit.result.cache
9+
/.phpunit.cache

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"laminas/laminas-coding-standard": "^2.4",
3030
"phpstan/phpstan": "^1.9",
3131
"phpstan/phpstan-webmozart-assert": "^1.2",
32-
"phpunit/phpunit": "^9.5",
32+
"phpunit/phpunit": "^10.0",
3333
"rector/rector": "dev-main"
3434
},
3535
"config": {

phpunit.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" testdox="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
1+
<?xml version="1.0"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" executionOrder="defects" cacheDirectory=".phpunit.cache">
3+
<coverage includeUncoveredFiles="true">
44
<include>
55
<directory suffix=".php">./src</directory>
66
</include>

rector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Rector\CodingStyle\Rector\Property\InlineSimplePropertyAnnotationRector;
66
use Rector\Config\RectorConfig;
77
use Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector;
8+
use Rector\PHPUnit\Set\PHPUnitSetList;
89
use Rector\Set\ValueObject\LevelSetList;
910
use Rector\Set\ValueObject\SetList;
1011

@@ -18,6 +19,7 @@
1819
SetList::PRIVATIZATION,
1920
SetList::PSR_4,
2021
SetList::TYPE_DECLARATION,
22+
PHPUnitSetList::PHPUNIT_100,
2123
]);
2224
$rectorConfig->rule(InlineSimplePropertyAnnotationRector::class);
2325

tests/AtLeastTest.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
namespace ArrayLookup\Tests;
66

77
use ArrayLookup\AtLeast;
8+
use PHPUnit\Framework\Attributes\DataProvider;
89
use PHPUnit\Framework\TestCase;
910

1011
final class AtLeastTest extends TestCase
1112
{
12-
/**
13-
* @dataProvider onceDataProvider
14-
*/
13+
#[DataProvider('onceDataProvider')]
1514
public function testOnce(array $data, callable $filter, bool $expected): void
1615
{
1716
$this->assertSame(
@@ -20,7 +19,7 @@ public function testOnce(array $data, callable $filter, bool $expected): void
2019
);
2120
}
2221

23-
public function onceDataProvider(): array
22+
public static function onceDataProvider(): array
2423
{
2524
return [
2625
[
@@ -46,9 +45,7 @@ public function onceDataProvider(): array
4645
];
4746
}
4847

49-
/**
50-
* @dataProvider twiceDataProvider
51-
*/
48+
#[DataProvider('twiceDataProvider')]
5249
public function testTwice(array $data, callable $filter, bool $expected): void
5350
{
5451
$this->assertSame(
@@ -58,7 +55,7 @@ public function testTwice(array $data, callable $filter, bool $expected): void
5855
}
5956

6057
// phpcs:disable
61-
public function twiceDataProvider(): array
58+
public static function twiceDataProvider(): array
6259
{
6360
return [
6461
[
@@ -85,10 +82,7 @@ public function twiceDataProvider(): array
8582
}
8683

8784
// phpcs:enable
88-
89-
/**
90-
* @dataProvider timesDataProvider
91-
*/
85+
#[DataProvider('timesDataProvider')]
9286
public function testTimes(array $data, callable $filter, bool $expected): void
9387
{
9488
$this->assertSame(
@@ -97,7 +91,7 @@ public function testTimes(array $data, callable $filter, bool $expected): void
9791
);
9892
}
9993

100-
public function timesDataProvider(): array
94+
public static function timesDataProvider(): array
10195
{
10296
return [
10397
[

tests/FinderTest.php

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88
use ArrayLookup\Finder;
99
use ArrayObject;
1010
use Generator;
11+
use PHPUnit\Framework\Attributes\DataProvider;
1112
use PHPUnit\Framework\TestCase;
1213

1314
use function str_contains;
1415

1516
final class FinderTest extends TestCase
1617
{
17-
/**
18-
* @dataProvider firstDataProvider
19-
*/
18+
#[DataProvider('firstDataProvider')]
2019
public function testFirst(iterable $data, callable $filter, mixed $expected): void
2120
{
2221
$this->assertSame(
@@ -25,7 +24,7 @@ public function testFirst(iterable $data, callable $filter, mixed $expected): vo
2524
);
2625
}
2726

28-
public function firstDataProvider(): array
27+
public static function firstDataProvider(): array
2928
{
3029
return [
3130
[
@@ -51,9 +50,7 @@ public function firstDataProvider(): array
5150
];
5251
}
5352

54-
/**
55-
* @dataProvider firstReturnKeyDataProvider
56-
*/
53+
#[DataProvider('firstReturnKeyDataProvider')]
5754
public function testFirstReturnKey(iterable $data, callable $filter, mixed $expected): void
5855
{
5956
$this->assertSame(
@@ -62,7 +59,7 @@ public function testFirstReturnKey(iterable $data, callable $filter, mixed $expe
6259
);
6360
}
6461

65-
public function firstReturnKeyDataProvider(): array
62+
public static function firstReturnKeyDataProvider(): array
6663
{
6764
return [
6865
[
@@ -88,9 +85,7 @@ public function firstReturnKeyDataProvider(): array
8885
];
8986
}
9087

91-
/**
92-
* @dataProvider lastDataProvider
93-
*/
88+
#[DataProvider('lastDataProvider')]
9489
public function testLast(iterable $data, callable $filter, mixed $expected): void
9590
{
9691
$this->assertSame(
@@ -99,7 +94,7 @@ public function testLast(iterable $data, callable $filter, mixed $expected): voi
9994
);
10095
}
10196

102-
public function lastDataProvider(): array
97+
public static function lastDataProvider(): array
10398
{
10499
$generator = static function (): Generator {
105100
yield 6;
@@ -162,9 +157,7 @@ public function lastDataProvider(): array
162157
];
163158
}
164159

165-
/**
166-
* @dataProvider lastReturnKeyDataProvider
167-
*/
160+
#[DataProvider('lastReturnKeyDataProvider')]
168161
public function testLastReturnKey(iterable $data, callable $filter, mixed $expected): void
169162
{
170163
$this->assertSame(
@@ -173,7 +166,7 @@ public function testLastReturnKey(iterable $data, callable $filter, mixed $expec
173166
);
174167
}
175168

176-
public function lastReturnKeyDataProvider(): array
169+
public static function lastReturnKeyDataProvider(): array
177170
{
178171
$generator = static function (): Generator {
179172
yield 6;
@@ -236,9 +229,7 @@ public function lastReturnKeyDataProvider(): array
236229
];
237230
}
238231

239-
/**
240-
* @dataProvider lastReturnKeyResortKeyDataProvider
241-
*/
232+
#[DataProvider('lastReturnKeyResortKeyDataProvider')]
242233
public function testLastReturnKeyResortKey(iterable $data, callable $filter, mixed $expected): void
243234
{
244235
$this->assertSame(
@@ -247,7 +238,7 @@ public function testLastReturnKeyResortKey(iterable $data, callable $filter, mix
247238
);
248239
}
249240

250-
public function lastReturnKeyResortKeyDataProvider(): array
241+
public static function lastReturnKeyResortKeyDataProvider(): array
251242
{
252243
return [
253244
[

tests/OnlyTest.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
namespace ArrayLookup\Tests;
66

77
use ArrayLookup\Only;
8+
use PHPUnit\Framework\Attributes\DataProvider;
89
use PHPUnit\Framework\TestCase;
910
use stdClass;
1011

1112
final class OnlyTest extends TestCase
1213
{
13-
/**
14-
* @dataProvider onceDataProvider
15-
*/
14+
#[DataProvider('onceDataProvider')]
1615
public function testOnce(array $data, callable $filter, bool $expected): void
1716
{
1817
$this->assertSame(
@@ -22,7 +21,7 @@ public function testOnce(array $data, callable $filter, bool $expected): void
2221
}
2322

2423
// phpcs:disable
25-
public function onceDataProvider(): array
24+
public static function onceDataProvider(): array
2625
{
2726
return [
2827
[
@@ -49,10 +48,7 @@ public function onceDataProvider(): array
4948
}
5049

5150
// phpcs:enable
52-
53-
/**
54-
* @dataProvider twiceDataProvider
55-
*/
51+
#[DataProvider('twiceDataProvider')]
5652
public function testTwice(array $data, callable $filter, bool $expected): void
5753
{
5854
$this->assertSame(
@@ -62,7 +58,7 @@ public function testTwice(array $data, callable $filter, bool $expected): void
6258
}
6359

6460
// phpcs:disable
65-
public function twiceDataProvider(): array
61+
public static function twiceDataProvider(): array
6662
{
6763
return [
6864
[
@@ -89,10 +85,7 @@ public function twiceDataProvider(): array
8985
}
9086

9187
// phpcs:enable
92-
93-
/**
94-
* @dataProvider timesDataProvider
95-
*/
88+
#[DataProvider('timesDataProvider')]
9689
public function testTimes(array $data, callable $filter, bool $expected): void
9790
{
9891
$this->assertSame(
@@ -101,7 +94,7 @@ public function testTimes(array $data, callable $filter, bool $expected): void
10194
);
10295
}
10396

104-
public function timesDataProvider(): array
97+
public static function timesDataProvider(): array
10598
{
10699
return [
107100
[

0 commit comments

Comments
 (0)