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

44 lines
695 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;
use Psl\Iter;
2019-12-24 01:52:07 +01:00
2019-12-25 00:35:14 +01:00
/**
* @covers \Psl\Arr\last
*/
2019-12-24 01:52:07 +01:00
class LastTest extends TestCase
{
2019-12-25 00:35:14 +01:00
/**
* @dataProvider provideData
*/
public function testLast($expected, array $array): void
{
static::assertSame($expected, Arr\last($array));
}
public function provideData(): array
{
return [
[
null,
[],
],
[
10,
Iter\to_array(Iter\range(0, 10)),
],
[
null,
[null],
],
];
}
2019-12-24 01:52:07 +01:00
}