endtoend-test-psl/tests/Psl/Vec/ShuffleTest.php
2021-02-13 20:16:20 +01:00

31 lines
588 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Vec;
use PHPUnit\Framework\TestCase;
use Psl\Iter;
use Psl\Vec;
final class ShuffleTest extends TestCase
{
public function testShuffle(): void
{
$array = [
'foo' => 'bar',
'bar' => 'baz',
'baz' => 'qux',
];
$shuffled = Vec\shuffle($array);
static::assertSameSize($shuffled, $array);
static::assertNotSame($shuffled, $array);
foreach ($shuffled as $value) {
static::assertTrue(Iter\contains($array, $value));
}
}
}