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

41 lines
662 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
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
}