Files
pest/tests/Features/Expect/toBeEmpty.php
2022-09-19 09:03:27 +02:00

24 lines
632 B
PHP

<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect([])->toBeEmpty();
expect(null)->toBeEmpty();
});
test('failures', function () {
expect([1, 2])->toBeEmpty();
expect(' ')->toBeEmpty();
})->throws(ExpectationFailedException::class);
test('failures with custom message', function () {
expect([1, 2])->toBeEmpty('oh no!');
expect(' ')->toBeEmpty('oh no!');
})->throws(ExpectationFailedException::class, 'oh no!');
test('not failures', function () {
expect([])->not->toBeEmpty();
expect(null)->not->toBeEmpty();
})->throws(ExpectationFailedException::class);