public function testMap() { $collection = new Collection(['a', 'b']); $expected = ['aa0', 'bb1']; $mapped = $collection->map(function ($value, $key) { return $value . $value . $key; }); $this->assertInstanceOf(Collection::class, $mapped); $this->assertNotSame($collection, $mapped); $this->assertSame($expected, $mapped->toArray()); }