Merge branch 'master' into method-match

This commit is contained in:
Nuno Maduro
2021-09-24 21:16:43 +01:00
committed by GitHub
4 changed files with 50 additions and 4 deletions

View File

@ -17,3 +17,23 @@ it('catch exceptions and messages', function () {
it('can just define the message', function () {
throw new Exception('Something bad happened');
})->throws('Something bad happened');
it('not catch exceptions if given condition is false', function () {
$this->assertTrue(true);
})->throwsIf(false, Exception::class);
it('catch exceptions if given condition is true', function () {
throw new Exception('Something bad happened');
})->throwsIf(function () { return true; }, Exception::class);
it('catch exceptions and messages if given condition is true', function () {
throw new Exception('Something bad happened');
})->throwsIf(true, Exception::class, 'Something bad happened');
it('can just define the message if given condition is true', function () {
throw new Exception('Something bad happened');
})->throwsIf(true, 'Something bad happened');
it('can just define the message if given condition is 1', function () {
throw new Exception('Something bad happened');
})->throwsIf(1, 'Something bad happened');