@@ -29,81 +29,81 @@ protected function getRule(): Rule
2929 );
3030 }
3131
32- public function testRule (): void
33- {
34- $ this ->phpunitVersion = 10 ;
35-
36- $ this ->analyse ([__DIR__ . '/data/data-provider-declaration.php ' ], [
37- [
38- '@dataProvider providebaz related method is used with incorrect case: provideBaz. ' ,
39- 16 ,
40- ],
41- [
42- '@dataProvider provideQux related method must be static in PHPUnit 10 and newer. ' ,
43- 16 ,
44- ],
45- [
46- '@dataProvider provideQuux related method must be public. ' ,
47- 16 ,
48- ],
49- [
50- '@dataProvider provideNonExisting related method not found. ' ,
51- 70 ,
52- ],
53- [
54- '@dataProvider NonExisting::provideNonExisting related class not found. ' ,
55- 70 ,
56- ],
57- [
58- '@dataProvider provideNonExisting related method not found. ' ,
59- 85 ,
60- ],
61- [
62- '@dataProvider provideNonExisting2 related method not found. ' ,
63- 86 ,
64- ],
65- [
66- '@dataProvider ExampleTestCase \\BarTestCase::providetootherclass related method is used with incorrect case: provideToOtherClass. ' ,
67- 87 ,
68- ],
69- [
70- '@dataProvider ExampleTestCase \\BarTestCase::providetootherclass related method is used with incorrect case: provideToOtherClass. ' ,
71- 88 ,
72- ],
73- ]);
74- }
75-
7632 /**
7733 * @dataProvider provideVersion
7834 */
79- public function testRulePhpUnit9orUnknown (?int $ version ): void
35+ public function testRule (?int $ version ): void
8036 {
8137 $ this ->phpunitVersion = $ version ;
8238
83- $ this ->analyse ([__DIR__ . '/data/data-provider-declaration.php ' ], [
84- [
85- '@dataProvider providebaz related method is used with incorrect case: provideBaz. ' ,
86- 16 ,
87- ],
88- [
89- '@dataProvider provideQuux related method must be public. ' ,
90- 16 ,
91- ],
92- [
93- '@dataProvider provideNonExisting related method not found. ' ,
94- 70 ,
95- ],
96- [
97- '@dataProvider NonExisting::provideNonExisting related class not found. ' ,
98- 70 ,
99- ],
100- ]);
39+ if ($ version === 10 ) {
40+ $ errors = [
41+ [
42+ '@dataProvider providebaz related method is used with incorrect case: provideBaz. ' ,
43+ 16 ,
44+ ],
45+ [
46+ '@dataProvider provideQux related method must be static in PHPUnit 10 and newer. ' ,
47+ 16 ,
48+ ],
49+ [
50+ '@dataProvider provideQuux related method must be public. ' ,
51+ 16 ,
52+ ],
53+ [
54+ '@dataProvider provideNonExisting related method not found. ' ,
55+ 70 ,
56+ ],
57+ [
58+ '@dataProvider NonExisting::provideNonExisting related class not found. ' ,
59+ 70 ,
60+ ],
61+ [
62+ '@dataProvider provideNonExisting related method not found. ' ,
63+ 85 ,
64+ ],
65+ [
66+ '@dataProvider provideNonExisting2 related method not found. ' ,
67+ 86 ,
68+ ],
69+ [
70+ '@dataProvider ExampleTestCase \\BarTestCase::providetootherclass related method is used with incorrect case: provideToOtherClass. ' ,
71+ 87 ,
72+ ],
73+ [
74+ '@dataProvider ExampleTestCase \\BarTestCase::providetootherclass related method is used with incorrect case: provideToOtherClass. ' ,
75+ 88 ,
76+ ],
77+ ];
78+ } else {
79+ $ errors = [
80+ [
81+ '@dataProvider providebaz related method is used with incorrect case: provideBaz. ' ,
82+ 16 ,
83+ ],
84+ [
85+ '@dataProvider provideQuux related method must be public. ' ,
86+ 16 ,
87+ ],
88+ [
89+ '@dataProvider provideNonExisting related method not found. ' ,
90+ 70 ,
91+ ],
92+ [
93+ '@dataProvider NonExisting::provideNonExisting related class not found. ' ,
94+ 70 ,
95+ ],
96+ ];
97+ }
98+
99+ $ this ->analyse ([__DIR__ . '/data/data-provider-declaration.php ' ], $ errors );
101100 }
102101
103102 static public function provideVersion (): iterable
104103 {
105- yield [9 ];
106104 yield [null ];
105+ yield [9 ];
106+ yield [10 ];
107107 }
108108
109109 public function testFixDataProviderStatic (): void
0 commit comments