endtoend-test-psl/tests/Psl/Arr/ShuffleTest.php
2019-12-25 19:46:58 +01:00

30 lines
565 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Psl\Arr;
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) {
self::assertTrue(Arr\contains($array, $value));
}
}
}