endtoend-test-psl/tests/Psl/Arr/ShuffleTest.php
2020-10-15 11:05:30 +02:00

30 lines
573 B
PHP

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