| @@ 100-108 (lines=9) @@ | ||
| 97 | $this->assertEquals(['f', 'b', 'b'], $result); |
|
| 98 | } |
|
| 99 | ||
| 100 | public function testReduce() |
|
| 101 | { |
|
| 102 | $coll = new Collection(['foo', 'bar', 'baz']); |
|
| 103 | $result = $coll->reduce(function ($carry, $item) { |
|
| 104 | return $carry . $item; |
|
| 105 | }); |
|
| 106 | ||
| 107 | $this->assertEquals('foobarbaz', $result); |
|
| 108 | } |
|
| 109 | ||
| 110 | public function testSort() |
|
| 111 | { |
|
| @@ 106-114 (lines=9) @@ | ||
| 103 | $this->assertEquals(['f', 'b', 'b'], $result); |
|
| 104 | } |
|
| 105 | ||
| 106 | public function testReduce() |
|
| 107 | { |
|
| 108 | $coll = new ImmutableCollection(['foo', 'bar', 'baz']); |
|
| 109 | $result = $coll->reduce(function ($carry, $item) { |
|
| 110 | return $carry . $item; |
|
| 111 | }); |
|
| 112 | ||
| 113 | $this->assertEquals('foobarbaz', $result); |
|
| 114 | } |
|
| 115 | ||
| 116 | public function testSort() |
|
| 117 | { |
|