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

Public Member Functions

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

Protected Member Functions

 getDummyIterator ()
 

Detailed Description

Class .

Test suite of the filter iterator.

Definition at line 66 of file Filter.php.

Member Function Documentation

Hoa\Iterator\Test\Unit\Filter::case_classic ( )

Definition at line 68 of file Filter.php.

69  {
70  $this
71  ->given(
72  $foobar = $this->getDummyIterator(),
73  $filter = new \Mock\Hoa\Iterator\Test\Unit\MyFilter($foobar),
74  $this->calling($filter)->accept = function () {
75  $value = $this->current();
76 
77  return false === in_array($value, ['a', 'e', 'i', 'o', 'u']);
78  }
79  )
80  ->when($result = iterator_to_array($filter))
81  ->then
82  ->array($result)
83  ->isEqualTo([
84  0 => 'f',
85  3 => 'b',
86  5 => 'r'
87  ]);
88  }

Here is the call graph for this function:

Hoa\Iterator\Test\Unit\Filter::case_remove_all ( )

Definition at line 90 of file Filter.php.

91  {
92  $this
93  ->given(
94  $foobar = $this->getDummyIterator(),
95  $filter = new \Mock\Hoa\Iterator\Test\Unit\MyFilter($foobar),
96  $this->calling($filter)->accept = false
97  )
98  ->when($result = iterator_to_array($filter))
99  ->then
100  ->array($result)
101  ->isEmpty();
102  }

Here is the call graph for this function:

Hoa\Iterator\Test\Unit\Filter::case_remove_none ( )

Definition at line 104 of file Filter.php.

105  {
106  $this
107  ->given(
108  $foobar = $this->getDummyIterator(),
109  $filter = new MyFilter($foobar)
110  )
111  ->when(
112  $foobarResult = iterator_to_array($foobar),
113  $filterResult = iterator_to_array($filter)
114  )
115  ->then
116  ->array($foobarResult)
117  ->isEqualTo($filterResult);
118  }

Here is the call graph for this function:

Hoa\Iterator\Test\Unit\Filter::getDummyIterator ( )
protected

Definition at line 120 of file Filter.php.

121  {
122  return new LUT\Map(['f', 'o', 'o', 'b', 'a', 'r']);
123  }

Here is the caller graph for this function:


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