given( $iterator = new LUT\Map(self::$_dummyArray), $repeater = new LUT\Repeater($iterator, 3) ) ->when($result = iterator_to_array($repeater)) ->then ->array($result) ->isEqualTo( self::$_dummyArray + self::$_dummyArray + self::$_dummyArray ); } public function case_with_body() { $self = $this; $this ->given( $iterator = new LUT\Map(self::$_dummyArray), $count = 0, $repeater = new LUT\Repeater( $iterator, 3, function ($repetition) use ($self, &$count) { $this ->integer($repetition) ->isEqualTo($count + 1); ++$count; }) ) ->when($result = iterator_to_array($repeater)) ->then ->array($result) ->isEqualTo( self::$_dummyArray + self::$_dummyArray + self::$_dummyArray ) ->integer($count) ->isEqualTo(3); } }