mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-11 16:49:40 +01:00
55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Arr;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Arr;
|
|
|
|
final class SelectKeysTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testSelectKeys(array $result, array $array, array $keys): void
|
|
{
|
|
static::assertSame($result, Arr\select_keys($array, $keys));
|
|
}
|
|
|
|
public function provideData(): array
|
|
{
|
|
return [
|
|
[
|
|
['foo' => 'bar', 'bar' => 'baz'],
|
|
['foo' => 'bar', 'bar' => 'baz', 'baz' => 'qux', 'qux' => 'foo'],
|
|
['foo', 'bar'],
|
|
],
|
|
|
|
[
|
|
[],
|
|
['baz' => 'qux', 'qux' => 'foo'],
|
|
['foo', 'bar'],
|
|
],
|
|
|
|
[
|
|
[],
|
|
[],
|
|
['foo', 'bar'],
|
|
],
|
|
|
|
[
|
|
[],
|
|
['foo' => 'bar', 'bar' => 'baz', 'baz' => 'qux', 'qux' => 'foo'],
|
|
[],
|
|
],
|
|
|
|
[
|
|
[],
|
|
['foo' => 'bar', 'bar' => 'baz', 'baz' => 'qux', 'qux' => 'foo'],
|
|
['a', 'b'],
|
|
],
|
|
];
|
|
}
|
|
}
|