/** * @dataProvider casesForMap */ public function testChainedMap($collection, $expected) { $self = $this; $iteratee = function ($value, $key, $collection2) use($self, $collection) { $self->assertSame($collection, $collection2); return $key . ' is ' . $value; }; $container = new Container($collection); $actual = $container->map($iteratee)->value(); $this->assertEquals($expected, $actual); }