Datasets can now access the test case and are executed after the setup method has run.

This commit is contained in:
luke
2021-07-28 10:39:39 +01:00
parent 252f9a0e46
commit d8fae6d689
4 changed files with 43 additions and 2 deletions

View File

@ -273,7 +273,19 @@ trait Testable
*/
public function __test()
{
return $this->__callClosure($this->__test, func_get_args());
return $this->__callClosure($this->__test, $this->resolveTestArguments(func_get_args()));
}
/**
* Resolve the passed arguments. Any Closures will be bound to the testcase and resolved.
*
* @throws Throwable
*/
private function resolveTestArguments(array $arguments): array
{
return array_map(function ($data) {
return $data instanceof Closure ? $this->__callClosure($data, []) : $data;
}, $arguments);
}
/**