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