mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-11 16:49:40 +01:00
26 lines
551 B
PHP
26 lines
551 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Iter;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Iter;
|
|
|
|
final class ReverseTest extends TestCase
|
|
{
|
|
public function testReverse(): void
|
|
{
|
|
$result = Iter\reverse(['foo', 'bar', 'baz', 'qux']);
|
|
|
|
static::assertSame(['qux', 'baz', 'bar', 'foo'], Iter\to_array_with_keys($result));
|
|
}
|
|
|
|
public function testReverseEarlyReturnForEmptyIterables(): void
|
|
{
|
|
$result = Iter\reverse(Iter\to_iterator([]));
|
|
|
|
static::assertSame([], Iter\to_array($result));
|
|
}
|
|
}
|