mirror of
https://github.com/pestphp/pest.git
synced 2026-03-12 10:47:25 +01:00
refactor: change falsy to false
This commit is contained in:
@ -105,7 +105,7 @@ final class TestCall
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts that the test throws the given `$exceptionClass` when called if the given condition is falsy.
|
* Asserts that the test throws the given `$exceptionClass` when called if the given condition is false.
|
||||||
*
|
*
|
||||||
* @param (callable(): bool)|bool $condition
|
* @param (callable(): bool)|bool $condition
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -64,25 +64,25 @@ it('not catch exceptions if given condition is true', function () {
|
|||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
})->throwsUnless(true, Exception::class);
|
})->throwsUnless(true, Exception::class);
|
||||||
|
|
||||||
it('catch exceptions if given condition is falsy', function () {
|
it('catch exceptions if given condition is false', function () {
|
||||||
throw new Exception('Something bad happened');
|
throw new Exception('Something bad happened');
|
||||||
})->throwsUnless(function () {
|
})->throwsUnless(function () {
|
||||||
return false;
|
return false;
|
||||||
}, Exception::class);
|
}, Exception::class);
|
||||||
|
|
||||||
it('catch exceptions and messages if given condition is falsy', function () {
|
it('catch exceptions and messages if given condition is false', function () {
|
||||||
throw new Exception('Something bad happened');
|
throw new Exception('Something bad happened');
|
||||||
})->throwsUnless(false, Exception::class, 'Something bad happened');
|
})->throwsUnless(false, Exception::class, 'Something bad happened');
|
||||||
|
|
||||||
it('catch exceptions, messages and code if given condition is falsy', function () {
|
it('catch exceptions, messages and code if given condition is false', function () {
|
||||||
throw new Exception('Something bad happened', 1);
|
throw new Exception('Something bad happened', 1);
|
||||||
})->throwsUnless(false, Exception::class, 'Something bad happened', 1);
|
})->throwsUnless(false, Exception::class, 'Something bad happened', 1);
|
||||||
|
|
||||||
it('can just define the message if given condition is falsy', function () {
|
it('can just define the message if given condition is false', function () {
|
||||||
throw new Exception('Something bad happened');
|
throw new Exception('Something bad happened');
|
||||||
})->throwsUnless(false, 'Something bad happened');
|
})->throwsUnless(false, 'Something bad happened');
|
||||||
|
|
||||||
it('can just define the code if given condition is falsy', function () {
|
it('can just define the code if given condition is false', function () {
|
||||||
throw new Exception('Something bad happened', 1);
|
throw new Exception('Something bad happened', 1);
|
||||||
})->throwsUnless(false, 1);
|
})->throwsUnless(false, 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user