mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
24 lines
632 B
PHP
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);
|