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