Skip to content

Commit

Permalink
Do not invoke data provider method using Reflection API
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Apr 2, 2024
1 parent 8540e10 commit 8d485f1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Metadata/Api/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ private function dataProvidedByMethods(string $className, string $methodName, Me
try {
$class = new ReflectionClass($_dataProvider->className());
$method = $class->getMethod($_dataProvider->methodName());
$object = null;

if (!$method->isPublic()) {
throw new InvalidDataProviderException(
Expand Down Expand Up @@ -142,7 +141,9 @@ private function dataProvidedByMethods(string $className, string $methodName, Me
);
}

$data = $method->invoke($object);
$className = $_dataProvider->className();
$methodName = $_dataProvider->methodName();
$data = $className::$methodName();
} catch (Throwable $e) {
Event\Facade::emitter()->dataProviderMethodFinished(
$testMethod,
Expand Down

0 comments on commit 8d485f1

Please sign in to comment.