forward bad TestCase method calls to global functions

This commit is contained in:
Félix Dorn
2020-08-25 13:45:55 +02:00
parent fe885fbfb6
commit 278af4b835
4 changed files with 16 additions and 1 deletions

View File

@ -6,6 +6,7 @@ namespace Pest\Support;
use Closure;
use Pest\Exceptions\ShouldNotHappen;
use Pest\TestSuite;
use ReflectionClass;
use ReflectionException;
use ReflectionFunction;
@ -40,6 +41,12 @@ final class Reflection
return $object->__call($method, $args);
}
if (is_callable($method)) {
return Closure::fromCallable($method)->bindTo(
TestSuite::getInstance()->test
)(...$args);
}
throw $exception;
}
}