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

19 lines
368 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-09-01 07:50:23 +02:00
use Psl\Iter;
2019-12-24 01:52:07 +01:00
class ReindexTest extends TestCase
{
2020-09-01 07:50:23 +02:00
public function testReindex(): void
{
2020-09-01 07:56:15 +02:00
$result = Iter\reindex([1, 2, 3], fn (int $value): int => $value);
2020-09-01 07:50:23 +02:00
self::assertSame([1 => 1, 2 => 2, 3 => 3], Iter\to_array_with_keys($result));
}
2019-12-24 01:52:07 +01:00
}