-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayConcatTest.php
More file actions
47 lines (38 loc) · 995 Bytes
/
ArrayConcatTest.php
File metadata and controls
47 lines (38 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
declare(strict_types=1);
namespace Recruiter\Array\Tests;
use PHPUnit\Framework\TestCase;
use function Recruiter\Array\array_concat;
class ArrayConcatTest extends TestCase
{
public function testConcat(): void
{
$this->assertSame(
[1, 2, 3, 4],
array_concat(1, [2, 3], [4]),
);
}
public function testContactWithIterator(): void
{
$this->assertSame(
[1, 2, 3, 4],
array_concat(1, new \ArrayIterator([2, 3]), [4]),
);
}
public function testConcatPreservesNestedArrays(): void
{
$this->assertSame(
[1, 2, [3], 4],
array_concat(1, [2, [3]], [4]),
);
}
public function testConcatEmpty(): void
{
$this->assertSame([], array_concat([], [], []));
}
public function testConcatCastToArray(): void
{
$this->assertSame([1], array_concat([1]));
$this->assertSame([1], array_concat(1));
}
}