2019-12-24 01:52:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Psl\Tests\Arr;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-12-25 00:35:14 +01:00
|
|
|
use Psl\Arr;
|
2019-12-24 01:52:07 +01:00
|
|
|
|
2020-10-15 10:18:03 +02:00
|
|
|
final class ConcatTest extends TestCase
|
2019-12-24 01:52:07 +01:00
|
|
|
{
|
2019-12-25 00:35:14 +01:00
|
|
|
/**
|
|
|
|
* @dataProvider provideData
|
|
|
|
*/
|
2020-08-27 16:14:37 +02:00
|
|
|
public function testConcat(array $expected, array $first, array ...$other): void
|
2019-12-25 00:35:14 +01:00
|
|
|
{
|
|
|
|
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'],
|
2020-08-27 16:14:37 +02:00
|
|
|
['foo'],
|
|
|
|
['bar'],
|
|
|
|
['baz', 'qux'],
|
2019-12-25 00:35:14 +01:00
|
|
|
],
|
|
|
|
[
|
|
|
|
[1, 2, 3],
|
|
|
|
[1, 2, 3],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
2019-12-24 01:52:07 +01:00
|
|
|
}
|