feat: adds fails

This commit is contained in:
Nuno Maduro
2023-12-28 10:31:39 +00:00
parent e00aba539a
commit f83d758d4b
3 changed files with 31 additions and 0 deletions

View File

@ -19,6 +19,7 @@ use Pest\Support\NullClosure;
use Pest\Support\Str;
use Pest\TestSuite;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\AssertionFailedError;
/**
* @internal
@ -57,6 +58,14 @@ final class TestCall
$this->testSuite->beforeEach->get($this->filename)[0]($this);
}
/**
* Asserts that the test fails with the given message.
*/
public function fails(?string $message = null): self
{
return $this->throws(AssertionFailedError::class, $message);
}
/**
* Asserts that the test throws the given `$exceptionClass` when called.
*/