mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-11 16:49:40 +01:00
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Arr;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Arr;
|
|
use Psl\Collection;
|
|
|
|
class ConcatTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testConcat(array $expected, iterable $first, iterable ...$other): void
|
|
{
|
|
static::assertSame($expected, Arr\concat($first, ...$other));
|
|
}
|
|
|
|
public function provideData(): array
|
|
{
|
|
return [
|
|
[
|
|
['a', 'b', 'c'],
|
|
['foo' => 'a'],
|
|
['bar' => 'b'],
|
|
['baz' => 'c'],
|
|
],
|
|
[
|
|
['foo', 'bar', 'baz', 'qux'],
|
|
new Collection\Map(['foo']),
|
|
new Collection\Vector(['bar']),
|
|
new Collection\Pair('baz', 'qux'),
|
|
],
|
|
[
|
|
[1, 2, 3],
|
|
[1, 2, 3],
|
|
],
|
|
[
|
|
['a', 'b', 'c', 'd', 'e'],
|
|
['a'],
|
|
(fn () => yield 'b')(),
|
|
new Collection\Map(['c']),
|
|
new Collection\Vector(['d']),
|
|
new Collection\ImmVector(['e']),
|
|
],
|
|
];
|
|
}
|
|
}
|