mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-02 17:56:09 +01:00
48 lines
775 B
PHP
48 lines
775 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Arr;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Arr;
|
|
|
|
/**
|
|
* @covers \Psl\Arr\first_key
|
|
*/
|
|
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'],
|
|
],
|
|
];
|
|
}
|
|
}
|