| @@ 90-98 (lines=9) @@ | ||
| 87 | $this->assertInstanceOf('Iterator', $coll->getIterator()); |
|
| 88 | } |
|
| 89 | ||
| 90 | public function testMap() |
|
| 91 | { |
|
| 92 | $coll = new Collection(['foo', 'bar', 'baz']); |
|
| 93 | $result = $coll->map(function ($item) { |
|
| 94 | return $item[0]; |
|
| 95 | }); |
|
| 96 | ||
| 97 | $this->assertEquals(['f', 'b', 'b'], $result); |
|
| 98 | } |
|
| 99 | ||
| 100 | public function testReduce() |
|
| 101 | { |
|
| @@ 96-104 (lines=9) @@ | ||
| 93 | $this->assertInstanceOf('Iterator', $coll->getIterator()); |
|
| 94 | } |
|
| 95 | ||
| 96 | public function testMap() |
|
| 97 | { |
|
| 98 | $coll = new ImmutableCollection(['foo', 'bar', 'baz']); |
|
| 99 | $result = $coll->map(function ($item) { |
|
| 100 | return $item[0]; |
|
| 101 | }); |
|
| 102 | ||
| 103 | $this->assertEquals(['f', 'b', 'b'], $result); |
|
| 104 | } |
|
| 105 | ||
| 106 | public function testReduce() |
|
| 107 | { |
|