endtoend-test-psl/tests/Psl/Vec/ValuesTest.php

31 lines
738 B
PHP
Raw Normal View History

2021-02-13 20:16:20 +01:00
<?php
declare(strict_types=1);
namespace Psl\Tests\Vec;
use PHPUnit\Framework\TestCase;
use Psl\Collection;
use Psl\Vec;
final class ValuesTest extends TestCase
{
/**
* @dataProvider provideTestValues
*/
public function testValues(array $expected, iterable $iterable): void
{
static::assertSame($expected, Vec\values($iterable));
}
public function provideTestValues(): iterable
{
yield [[], []];
yield [[null], [null]];
yield [[1, 2], [1, 2]];
yield [[1, 2, 3, 4, 5], Vec\range(1, 5)];
yield [['hello', 'world'], new Collection\Map(['foo' => 'hello', 'bar' => 'world'])];
yield [['foo', 'bar'], new Collection\Vector(['foo', 'bar'])];
}
}