Skip to content

Commit 57c04d2

Browse files
Pass ReflectionMethod object for test method to avoid overwriting the $className and $methodName variables in the loop
1 parent 72083e3 commit 57c04d2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Metadata/Api/DataProvider.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function providedData(string $className, string $methodName): ?array
6262
$this->triggerWarningForMixingOfDataProviderAndTestWith($testMethod);
6363
}
6464

65-
$data = $this->dataProvidedByMethods($className, $methodName, $dataProvider);
65+
$data = $this->dataProvidedByMethods($testMethod, $dataProvider);
6666
} else {
6767
$data = $this->dataProvidedByMetadata($testWith);
6868
}
@@ -99,16 +99,13 @@ public function providedData(string $className, string $methodName): ?array
9999
}
100100

101101
/**
102-
* @param class-string<TestCase> $className
103-
* @param non-empty-string $methodName
104-
*
105102
* @throws InvalidDataProviderException
106103
*
107104
* @return array<ProvidedData>
108105
*/
109-
private function dataProvidedByMethods(string $className, string $methodName, MetadataCollection $dataProvider): array
106+
private function dataProvidedByMethods(ReflectionMethod $testMethod, MetadataCollection $dataProvider): array
110107
{
111-
$testMethod = new Event\Code\ClassMethod($className, $methodName);
108+
$testMethod = new Event\Code\ClassMethod($testMethod->getDeclaringClass()->getName(), $testMethod->getName());
112109
$methodsCalled = [];
113110
$result = [];
114111

0 commit comments

Comments
 (0)