feat: adds repeat

This commit is contained in:
Nuno Maduro
2023-07-30 23:49:20 +01:00
parent 86a6b32715
commit f3f35a2ed1
7 changed files with 185 additions and 6 deletions

View File

@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Pest\PendingCalls;
use Closure;
use InvalidArgumentException;
use Pest\Exceptions\InvalidArgumentException;
use Pest\Factories\Covers\CoversClass;
use Pest\Factories\Covers\CoversFunction;
use Pest\Factories\Covers\CoversNothing;
@ -214,6 +214,20 @@ final class TestCall
: $this;
}
/**
* Repeats the current test the given number of times.
*/
public function repeat(int $times): self
{
if ($times < 1) {
throw new InvalidArgumentException('The number of repetitions must be greater than 0.');
}
$this->testCaseMethod->repetitions = $times;
return $this;
}
/**
* Sets the test as "todo".
*/