endtoend-test-psl/tests/Psl/Arr/FirstKeyTest.php

48 lines
775 B
PHP
Raw Normal View History

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
2019-12-25 00:35:14 +01:00
/**
* @covers \Psl\Arr\first_key
*/
2019-12-24 01:52:07 +01:00
class FirstKeyTest extends TestCase
{
2019-12-25 00:35:14 +01:00
/**
* @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'],
],
];
}
2019-12-24 01:52:07 +01:00
}