endtoend-test-psl/tests/Psl/Iter/IsEmptyTest.php

31 lines
629 B
PHP
Raw Normal View History

2019-12-24 01:52:07 +01:00
<?php
declare(strict_types=1);
namespace Psl\Tests\Iter;
use PHPUnit\Framework\TestCase;
2020-08-08 06:35:34 +02:00
use Psl\Iter;
2019-12-24 01:52:07 +01:00
class IsEmptyTest extends TestCase
{
2020-08-08 06:35:34 +02:00
/**
* @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']];
}
2019-12-24 01:52:07 +01:00
}