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

45 lines
743 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Psl\Arr;
final class FirstKeyTest extends TestCase
{
/**
* @dataProvider provideData
*/
public function testFirstKey($expected, array $array): void
{
static::assertSame($expected, Arr\first_key($array));
}
public function provideData(): array
{
return [
[
null,
[],
],
[
0,
[1],
],
[
1,
[1 => 'foo'],
],
[
'bar',
['bar' => 'baz', 'baz' => 'qux'],
],
];
}
}