endtoend-test-psl/tests/Psl/Arr/ContainsTest.php

30 lines
577 B
PHP
Raw Normal View History

2019-12-24 01:52:07 +01:00
<?php
declare(strict_types=1);
namespace Psl\Tests\Arr;
use PHPUnit\Framework\TestCase;
2019-12-25 00:35:14 +01:00
use Psl\Arr;
2019-12-24 01:52:07 +01:00
final class ContainsTest extends TestCase
2019-12-24 01:52:07 +01:00
{
2019-12-25 00:35:14 +01:00
/**
* @dataProvider provideData
*/
2020-08-25 02:17:33 +02:00
public function testContains(bool $expected, array $array, $value): void
2019-12-25 00:35:14 +01:00
{
2020-08-25 02:17:33 +02:00
static::assertSame($expected, Arr\contains($array, $value));
2019-12-25 00:35:14 +01:00
}
public function provideData(): array
{
return [
[true, [1, 2], 1],
[false, ['0'], 0],
2020-08-25 02:17:33 +02:00
[false, [], 'hello'],
[false, ['HELLO'], 'hello'],
2019-12-25 00:35:14 +01:00
];
}
2019-12-24 01:52:07 +01:00
}