mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
feat: allows to chain todo
This commit is contained in:
@ -87,7 +87,7 @@ if (! function_exists('test')) {
|
||||
* is the test description; the second argument is
|
||||
* a closure that contains the test expectations.
|
||||
*
|
||||
* @return TestCall|TestCase|mixed
|
||||
* @return HigherOrderTapProxy<TestCall|TestCase>|TestCall
|
||||
*/
|
||||
function test(string $description = null, Closure $closure = null): HigherOrderTapProxy|TestCall
|
||||
{
|
||||
@ -130,10 +130,11 @@ if (! function_exists('todo')) {
|
||||
*/
|
||||
function todo(string $description): TestCall
|
||||
{
|
||||
/* @phpstan-ignore-next-line */
|
||||
return test($description, fn () => self::markTestSkipped(
|
||||
'__TODO__',
|
||||
));
|
||||
$test = test($description);
|
||||
|
||||
assert($test instanceof TestCall);
|
||||
|
||||
return $test->skip('__TODO__');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -170,6 +170,16 @@ final class TestCall
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the test as "todo".
|
||||
*/
|
||||
public function todo(): self
|
||||
{
|
||||
$this->skip('__TODO__');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the covered classes or methods.
|
||||
*/
|
||||
|
||||
@ -44,7 +44,7 @@ final class ExceptionTrace
|
||||
*/
|
||||
public static function removePestReferences(Throwable $t): void
|
||||
{
|
||||
if (! property_exists($t, 'serializableTrace')) { // @phpstan-ignore-line
|
||||
if (! property_exists($t, 'serializableTrace')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,10 @@ use Throwable;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @template TProxy
|
||||
*
|
||||
* @mixin TProxy
|
||||
*/
|
||||
final class HigherOrderTapProxy
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user