mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-02 17:56:09 +01:00
34 lines
806 B
PHP
34 lines
806 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Iter;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Collection;
|
|
use Psl\Iter;
|
|
|
|
class ValuesTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideTestValues
|
|
*/
|
|
public function testValues(array $expected, iterable $iterable): void
|
|
{
|
|
$result = Iter\values($iterable);
|
|
$result = Iter\to_array($result);
|
|
|
|
static::assertSame($expected, $result);
|
|
}
|
|
|
|
public function provideTestValues(): iterable
|
|
{
|
|
yield [[], []];
|
|
yield [[null], [null]];
|
|
yield [[1, 2], [1, 2]];
|
|
yield [[1, 2, 3, 4, 5], Iter\range(1, 5)];
|
|
yield [['hello', 'world'], new Collection\Map(['foo' => 'hello', 'bar' => 'world'])];
|
|
yield [['foo', 'bar'], new Collection\Vector(['foo', 'bar'])];
|
|
}
|
|
}
|