public function test_map() { $collection = new Collection(array(1, 2, 3, 5)); $mapped = $collection->map(function ($v) { return $v * 2; }); $this->assertSame(array(2, 4, 6, 10), $mapped->toArray(), 'All values should be doubled'); $this->assertSame(array(1, 2, 3, 5), $collection->toArray(), 'Original array should remain intact'); }