endtoend-test-psl/tests/Psl/Iter/IsEmptyTest.php
2020-08-08 05:35:34 +01:00

31 lines
629 B
PHP

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