endtoend-test-psl/tests/Psl/Arr/ContainsKeyTest.php
2019-12-25 16:56:21 +01:00

32 lines
581 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Psl\Arr;
/**
* @covers \Psl\Arr\contains_key
*/
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],
];
}
}