mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-11 16:49:40 +01:00
30 lines
565 B
PHP
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));
|
|
}
|
|
}
|
|
}
|