Merge pull request #685 from fabio-ivona/fix-multiple-dataset-test-case-access

Fix multiple dataset test case access
This commit is contained in:
Nuno Maduro
2023-03-13 17:53:40 +00:00
committed by GitHub
5 changed files with 60 additions and 15 deletions

View File

@ -228,7 +228,22 @@ trait Testable
$this->__description = self::$__latestDescription = $this->dataName() ? $method->description.' with '.$this->dataName() : $method->description;
$underlyingTest = Reflection::getFunctionVariable($this->__test, 'closure');
$testParameterTypes = array_values(Reflection::getFunctionArguments($underlyingTest));
if (count($arguments) !== 1) {
foreach ($arguments as $argumentIndex => $argumentValue) {
if (! $argumentValue instanceof Closure) {
continue;
}
if (in_array($testParameterTypes[$argumentIndex], [\Closure::class, 'callable', 'mixed'])) {
continue;
}
$arguments[$argumentIndex] = $this->__callClosure($argumentValue, []);
}
return $arguments;
}
@ -236,9 +251,6 @@ trait Testable
return $arguments;
}
$underlyingTest = Reflection::getFunctionVariable($this->__test, 'closure');
$testParameterTypes = array_values(Reflection::getFunctionArguments($underlyingTest));
if (in_array($testParameterTypes[0], [\Closure::class, 'callable'])) {
return $arguments;
}