2019-12-24 01:52:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Psl\Tests\Iter;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2020-07-07 15:17:36 +02:00
|
|
|
use Psl\Collection\MutableVector;
|
|
|
|
use Psl\Iter;
|
2019-12-24 01:52:07 +01:00
|
|
|
|
2020-10-15 10:18:03 +02:00
|
|
|
final class ApplyTest extends TestCase
|
2019-12-24 01:52:07 +01:00
|
|
|
{
|
2020-07-07 15:17:36 +02:00
|
|
|
public function testApply(): void
|
|
|
|
{
|
|
|
|
$vec = new MutableVector([]);
|
2020-10-15 10:18:03 +02:00
|
|
|
Iter\apply([1, 2, 3], static fn (int $i) => $vec->add($i));
|
2020-07-07 15:17:36 +02:00
|
|
|
|
2020-10-15 10:18:03 +02:00
|
|
|
static::assertSame([1, 2, 3], $vec->toArray());
|
2020-07-07 15:17:36 +02:00
|
|
|
}
|
2019-12-24 01:52:07 +01:00
|
|
|
}
|