mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-11 16:49:40 +01:00
29 lines
542 B
PHP
29 lines
542 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Arr;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Arr;
|
|
|
|
final class IdxTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testIdx($expected, array $array, $key, $default): void
|
|
{
|
|
static::assertSame($expected, Arr\idx($array, $key, $default));
|
|
}
|
|
|
|
public function provideData(): array
|
|
{
|
|
return [
|
|
[6, [], 5, 6],
|
|
[null, ['foo' => null], 'foo', 'bar'],
|
|
[1, [1], 0, 2],
|
|
];
|
|
}
|
|
}
|