implemented support for PHPUnit's @depends

This commit is contained in:
Adrian Nürnberger
2020-06-19 19:50:54 +02:00
parent 283d8f3e03
commit d0a74931dd
7 changed files with 120 additions and 12 deletions

View File

@ -53,6 +53,11 @@ trait TestCase
$this->setGroups($groups);
}
public function addDependencies(array $tests): void
{
$this->setDependencies($tests);
}
/**
* Returns the test case name. Note that, in Pest
* we ignore withDataset argument as the description
@ -130,16 +135,16 @@ trait TestCase
/**
* Runs the test.
*/
public function __test(): void
public function __test()
{
$this->__callClosure($this->__test, func_get_args());
return $this->__callClosure($this->__test, func_get_args());
}
private function __callClosure(Closure $closure, array $arguments): void
private function __callClosure(Closure $closure, array $arguments)
{
ExceptionTrace::ensure(function () use ($closure, $arguments) {
call_user_func_array(Closure::bind($closure, $this, get_class($this)), $arguments);
});
return ExceptionTrace::ensure(function () use ($closure, $arguments) {
return call_user_func_array(Closure::bind($closure, $this, get_class($this)), $arguments);
})->getValue();
}
public function getPrintableTestCaseName(): string