endtoend-test-psl/tests/Psl/Iter/IsEmptyTest.php
2020-10-15 11:05:30 +02:00

31 lines
644 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Iter;
use PHPUnit\Framework\TestCase;
use Psl\Iter;
final class IsEmptyTest extends TestCase
{
/**
* @dataProvider provideData
*/
public function testIsEmpty(bool $expected, iterable $iterable): void
{
static::assertSame($expected, Iter\is_empty($iterable));
}
public function provideData(): iterable
{
yield [true, []];
yield [true, Iter\from_entries([])];
yield [true, (static fn () => yield from [])()];
yield [false, [null]];
yield [false, [false]];
yield [false, ['hello', 'world']];
}
}