@@ -266,37 +266,15 @@ private function formatKey(int|string $key): string
266
266
private function triggerWarningForMixingOfDataProviderAndTestWith (ReflectionMethod $ method ): void
267
267
{
268
268
Event \Facade::emitter ()->testTriggeredPhpunitWarning (
269
- new TestMethod (
270
- $ method ->getDeclaringClass ()->getName (),
271
- $ method ->getName (),
272
- $ method ->getFileName (),
273
- $ method ->getStartLine (),
274
- Event \Code \TestDoxBuilder::fromClassNameAndMethodName (
275
- $ method ->getDeclaringClass ()->getName (),
276
- $ method ->getName (),
277
- ),
278
- MetadataCollection::fromArray ([]),
279
- Event \TestData \TestDataCollection::fromArray ([]),
280
- ),
269
+ $ this ->testValueObject ($ method ),
281
270
'Mixing #[DataProvider*] and #[TestWith*] attributes is not supported, only the data provided by #[DataProvider*] will be used ' ,
282
271
);
283
272
}
284
273
285
274
private function triggerWarningForArgumentCount (ReflectionMethod $ method , string $ key , string $ label , int $ numberOfValues , int $ testMethodNumberOfParameters ): void
286
275
{
287
276
Event \Facade::emitter ()->testTriggeredPhpunitWarning (
288
- new TestMethod (
289
- $ method ->getDeclaringClass ()->getName (),
290
- $ method ->getName (),
291
- $ method ->getFileName (),
292
- $ method ->getStartLine (),
293
- Event \Code \TestDoxBuilder::fromClassNameAndMethodName (
294
- $ method ->getDeclaringClass ()->getName (),
295
- $ method ->getName (),
296
- ),
297
- MetadataCollection::fromArray ([]),
298
- Event \TestData \TestDataCollection::fromArray ([]),
299
- ),
277
+ $ this ->testValueObject ($ method ),
300
278
sprintf (
301
279
'Data set %s provided by %s has more arguments (%d) than the test method accepts (%d) ' ,
302
280
$ key ,
@@ -306,4 +284,20 @@ private function triggerWarningForArgumentCount(ReflectionMethod $method, string
306
284
),
307
285
);
308
286
}
287
+
288
+ private function testValueObject (ReflectionMethod $ method ): TestMethod
289
+ {
290
+ return new TestMethod (
291
+ $ method ->getDeclaringClass ()->getName (),
292
+ $ method ->getName (),
293
+ $ method ->getFileName (),
294
+ $ method ->getStartLine (),
295
+ Event \Code \TestDoxBuilder::fromClassNameAndMethodName (
296
+ $ method ->getDeclaringClass ()->getName (),
297
+ $ method ->getName (),
298
+ ),
299
+ MetadataCollection::fromArray ([]),
300
+ Event \TestData \TestDataCollection::fromArray ([]),
301
+ );
302
+ }
309
303
}
0 commit comments