public function testLimitMapCollector() { $array = ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6]; $stream = new Stream($array); $stream->limit(2); $res = $stream->collect(new MapCollector()); $this->assertEquals(['a' => 1, 'b' => 2], $res); }