2019-12-24 01:52:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Psl\Tests\Arr;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-12-25 00:35:14 +01:00
|
|
|
use Psl\Arr;
|
2019-12-24 01:52:07 +01:00
|
|
|
|
2020-10-15 10:18:03 +02:00
|
|
|
use function array_keys;
|
|
|
|
|
|
|
|
final class KeysTest extends TestCase
|
2019-12-24 01:52:07 +01:00
|
|
|
{
|
2019-12-25 00:35:14 +01:00
|
|
|
public function testValues(): void
|
|
|
|
{
|
|
|
|
$array = [
|
|
|
|
'foo' => 'bar',
|
|
|
|
'bar' => 'baz',
|
|
|
|
'baz' => 'qux',
|
|
|
|
];
|
|
|
|
|
|
|
|
$keys = Arr\keys($array);
|
|
|
|
|
2020-10-15 10:18:03 +02:00
|
|
|
static::assertSameSize($keys, $array);
|
|
|
|
static::assertSame($keys, array_keys($array));
|
2019-12-25 00:35:14 +01:00
|
|
|
|
|
|
|
foreach ($array as $key => $value) {
|
2020-10-15 10:18:03 +02:00
|
|
|
static::assertTrue(Arr\contains($keys, $key));
|
2019-12-25 00:35:14 +01:00
|
|
|
}
|
|
|
|
}
|
2019-12-24 01:52:07 +01:00
|
|
|
}
|