-
Notifications
You must be signed in to change notification settings - Fork 0
/
TransparentIteratorTest.php
52 lines (48 loc) · 1.25 KB
/
TransparentIteratorTest.php
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
48
49
50
51
52
<?php
namespace MaxGoryunov\SavingIterator\Tests\Src;
use ArrayIterator;
use MaxGoryunov\SavingIterator\Fakes\The;
use MaxGoryunov\SavingIterator\Src\TransparentIterator;
use PHPUnit\Framework\TestCase;
/**
* @coversDefaultClass MaxGoryunov\SavingIterator\Src\TransparentIterator
*/
class TransparentIteratorTest extends TestCase
{
/**
* @covers ::__construct
* @covers ::current
* @covers ::key
* @covers ::valid
* @covers ::rewind
* @covers ::next
*
* @uses MaxGoryunov\SavingIterator\Fakes\SurveyEnvelope
* @uses MaxGoryunov\SavingIterator\Fakes\The
*
* @small
*
* @return void
*/
public function testBehavesAsIterator(): void
{
(new The(
[
"apples" => 4,
"bananas" => 10,
"oranges" => 5,
"tomatoes" => 7,
"watermelons" => 18,
"plums" => 3
],
fn(array $greens) => $this->assertEquals(
$greens,
iterator_to_array(
new TransparentIterator(
new ArrayIterator($greens)
)
)
)
))->value();
}
}