endtoend-test-psl/tests/Psl/Arr/FirstTest.php
2019-12-25 19:46:58 +01:00

41 lines
664 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Psl\Arr;
use Psl\Iter;
class FirstTest extends TestCase
{
/**
* @dataProvider provideData
*/
public function testFirst($expected, array $array): void
{
static::assertSame($expected, Arr\first($array));
}
public function provideData(): array
{
return [
[
null,
[],
],
[
0,
Iter\to_array(Iter\range(0, 10)),
],
[
null,
[null],
],
];
}
}