endtoend-test-psl/tests/Psl/Iter/ChainTest.php
2020-07-16 16:11:54 +01:00

29 lines
652 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Iter;
use PHPUnit\Framework\TestCase;
use Psl\Collection;
use Psl\Iter;
class ChainTest extends TestCase
{
public function testChain(): void
{
static::assertCount(0, Iter\chain());
static::assertCount(0, Iter\chain([], new Iter\Iterator([])));
static::assertCount(0, Iter\chain([], new Iter\Iterator([])));
/** @var Iter\Iterator<int, int> $chain */
$chain = Iter\chain(
[1],
Iter\range(2, 5),
new Collection\Vector([6])
);
static::assertSame([1, 2, 3, 4, 5, 6], Iter\to_array($chain));
}
}