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

31 lines
644 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
final class IsEmptyTest extends TestCase
2019-12-24 01:52:07 +01:00
{
2020-08-08 06:35:34 +02:00
/**
* @dataProvider provideData
*/
public function testIsEmpty(bool $expected, iterable $iterable): void
{
static::assertSame($expected, Iter\is_empty($iterable));
2020-08-08 06:35:34 +02:00
}
public function provideData(): iterable
{
yield [true, []];
yield [true, Iter\from_entries([])];
yield [true, (static fn () => yield from [])()];
2020-08-08 06:35:34 +02:00
yield [false, [null]];
yield [false, [false]];
yield [false, ['hello', 'world']];
}
2019-12-24 01:52:07 +01:00
}