mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-02 17:56:09 +01:00
31 lines
588 B
PHP
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));
|
|
}
|
|
}
|
|
}
|