endtoend-test-psl/tests/Psl/Arr/ContainsKeyTest.php
2020-10-15 11:05:30 +02:00

29 lines
546 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Psl\Arr;
final class ContainsKeyTest extends TestCase
{
/**
* @dataProvider provideData
*/
public function testContainsKey(bool $expected, array $array, $key): void
{
static::assertSame($expected, Arr\contains_key($array, $key));
}
public function provideData(): array
{
return [
[false, [], 5],
[true, ['foo' => null], 'foo'],
[true, [1], 0],
];
}
}