14
14
namespace Ecommit \ScalarValues \Tests ;
15
15
16
16
use Ecommit \ScalarValues \ScalarValues ;
17
+ use PHPUnit \Framework \Attributes \DataProvider ;
17
18
use PHPUnit \Framework \TestCase ;
18
19
19
20
class ScalarValuesTest extends TestCase
20
21
{
21
- /**
22
- * @dataProvider getTestContainsOnlyScalarValuesProdiver
23
- */
22
+ #[DataProvider('getTestContainsOnlyScalarValuesProdiver ' )]
24
23
public function testContainsOnlyScalarValues (array $ input , bool $ expected ): void
25
24
{
26
25
$ this ->assertEquals (
@@ -29,7 +28,7 @@ public function testContainsOnlyScalarValues(array $input, bool $expected): void
29
28
);
30
29
}
31
30
32
- public function getTestContainsOnlyScalarValuesProdiver (): array
31
+ public static function getTestContainsOnlyScalarValuesProdiver (): array
33
32
{
34
33
// Colonne 1: Input
35
34
// Colonne 2: Expected result
@@ -48,16 +47,14 @@ public function getTestContainsOnlyScalarValuesProdiver(): array
48
47
];
49
48
}
50
49
51
- /**
52
- * @dataProvider getNotArrayInputProdiver
53
- */
50
+ #[DataProvider('getNotArrayInputProdiver ' )]
54
51
public function testContainsOnlyScalarValuesInputError (mixed $ input ): void
55
52
{
56
53
$ this ->expectException (\TypeError::class);
57
54
ScalarValues::containsOnlyScalarValues ($ input ); // @phpstan-ignore-line
58
55
}
59
56
60
- public function getNotArrayInputProdiver (): array
57
+ public static function getNotArrayInputProdiver (): array
61
58
{
62
59
return [
63
60
[null ],
@@ -68,9 +65,7 @@ public function getNotArrayInputProdiver(): array
68
65
];
69
66
}
70
67
71
- /**
72
- * @dataProvider getTestFilterScalarValuesProdiver
73
- */
68
+ #[DataProvider('getTestFilterScalarValuesProdiver ' )]
74
69
public function testFilterScalarValues (array $ input , array $ expected ): void
75
70
{
76
71
$ this ->assertEquals (
@@ -79,7 +74,7 @@ public function testFilterScalarValues(array $input, array $expected): void
79
74
);
80
75
}
81
76
82
- public function getTestFilterScalarValuesProdiver (): array
77
+ public static function getTestFilterScalarValuesProdiver (): array
83
78
{
84
79
// Colonne 1: Input
85
80
// Colonne 2: Expected result
@@ -98,9 +93,7 @@ public function getTestFilterScalarValuesProdiver(): array
98
93
];
99
94
}
100
95
101
- /**
102
- * @dataProvider getNotArrayInputProdiver
103
- */
96
+ #[DataProvider('getNotArrayInputProdiver ' )]
104
97
public function testFilterScalarValuesInputError (mixed $ input ): void
105
98
{
106
99
$ this ->expectException (\TypeError::class);
0 commit comments