mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
24 lines
487 B
PHP
24 lines
487 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\ExpectationFailedException;
|
|
|
|
test('pass', function () {
|
|
expect([])->toBeIterable();
|
|
expect(null)->not->toBeIterable();
|
|
});
|
|
|
|
test('failures', function () {
|
|
expect(42)->toBeIterable();
|
|
})->throws(ExpectationFailedException::class);
|
|
|
|
test('not failures', function () {
|
|
function gen(): iterable
|
|
{
|
|
yield 1;
|
|
yield 2;
|
|
yield 3;
|
|
}
|
|
|
|
expect(gen())->not->toBeIterable();
|
|
})->throws(ExpectationFailedException::class);
|