Hoa central
Public Member Functions | List of all members
Hoa\Iterator\Test\Unit\Demultiplexer Class Reference
Inheritance diagram for Hoa\Iterator\Test\Unit\Demultiplexer:

Public Member Functions

 case_classic ()
 
 case_associative_keys ()
 
- Public Member Functions inherited from Hoa\Test\Unit\Suite
 __construct ()
 
 getTestedClassName ()
 
 getTestedClassNamespace ()
 
 beforeTestMethod ($methodName)
 

Detailed Description

Class .

Test suite of the demultiplexer iterator.

Definition at line 50 of file Demultiplexer.php.

Member Function Documentation

Hoa\Iterator\Test\Unit\Demultiplexer::case_associative_keys ( )

Definition at line 84 of file Demultiplexer.php.

85  {
86  $this
87  ->given(
88  $counter = new LUT\Counter(0, 10, 1),
89  $multiple = new LUT\Multiple(
90  LUT\Multiple::MIT_NEED_ANY
91  | LUT\Multiple::MIT_KEYS_ASSOC
92  ),
93  $multiple->attachIterator($counter, 'one'),
94  $multiple->attachIterator(clone $counter, 'two'),
95  $demultiplexer = new LUT\Demultiplexer(
96  $multiple,
97  function ($current) {
98  return $current['one'] * $current['two'];
99  }
100  )
101  )
102  ->when($result = iterator_to_array($demultiplexer, false))
103  ->then
104  ->array($result)
105  ->isEqualTo([
106  0,
107  1,
108  4,
109  9,
110  16,
111  25,
112  36,
113  49,
114  64,
115  81
116  ]);
117  }
Hoa\Iterator\Test\Unit\Demultiplexer::case_classic ( )

Definition at line 52 of file Demultiplexer.php.

53  {
54  $this
55  ->given(
56  $counter = new LUT\Counter(0, 10, 1),
57  $multiple = new LUT\Multiple(),
58  $multiple->attachIterator($counter),
59  $multiple->attachIterator(clone $counter),
60  $demultiplexer = new LUT\Demultiplexer(
61  $multiple,
62  function ($current) {
63  return $current[0] * $current[1];
64  }
65  )
66  )
67  ->when($result = iterator_to_array($demultiplexer, false))
68  ->then
69  ->array($result)
70  ->isEqualTo([
71  0,
72  1,
73  4,
74  9,
75  16,
76  25,
77  36,
78  49,
79  64,
80  81
81  ]);
82  }

The documentation for this class was generated from the following file: