given( $foo = new LUT\Map(['f', 'o', 'o']), $bar = new LUT\Map(['b', 'a', 'r']), $multiple = new LUT\Multiple( LUT\Multiple::MIT_NEED_ANY | LUT\Multiple::MIT_KEYS_ASSOC ), $multiple->attachIterator($foo, 'one'), $multiple->attachIterator($bar, 'two') ) ->when($result = iterator_to_array($multiple, false)) ->then ->array($result) ->isEqualTo([ ['one' => 'f', 'two' => 'b'], ['one' => 'o', 'two' => 'a'], ['one' => 'o', 'two' => 'r'] ]); } public function case_default_value() { $this ->given( $foobar = new LUT\Map(['f', 'o', 'o', 'b', 'a', 'r']), $baz = new LUT\Map(['b', 'a', 'z']), $multiple = new LUT\Multiple( LUT\Multiple::MIT_NEED_ANY | LUT\Multiple::MIT_KEYS_ASSOC ), $multiple->attachIterator($foobar, 'one', '!'), $multiple->attachIterator($baz, 'two', '?') ) ->when($result = iterator_to_array($multiple, false)) ->then ->array($result) ->isEqualTo([ ['one' => 'f', 'two' => 'b'], ['one' => 'o', 'two' => 'a'], ['one' => 'o', 'two' => 'z'], ['one' => 'b', 'two' => '?'], ['one' => 'a', 'two' => '?'], ['one' => 'r', 'two' => '?'], ]); } public function case_empty() { $this ->given($multiple = new LUT\Multiple()) ->when($result = iterator_to_array($multiple)) ->then ->array($result) ->isEmpty(); } }