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

Public Member Functions

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

Detailed Description

Class .

Test suite of the regular expression iterator.

Definition at line 50 of file RegularExpression.php.

Member Function Documentation

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

Definition at line 52 of file RegularExpression.php.

53  {
54  $this
55  ->given(
56  $map = new LUT\Map([
57  'abc',
58  'dea',
59  'fgh',
60  'iaj',
61  'klm'
62  ]),
63  $iterator = new LUT\RegularExpression($map, '/a/')
64  )
65  ->when($result = iterator_to_array($iterator))
66  ->then
67  ->array($result)
68  ->isEqualTo([
69  0 => 'abc',
70  1 => 'dea',
71  3 => 'iaj'
72  ]);
73  }
Hoa\Iterator\Test\Unit\RegularExpression::case_recursive ( )

Definition at line 75 of file RegularExpression.php.

76  {
77  $this
78  ->given(
79  $map = new LUT\Recursive\Map([
80  ['abc', 'dea', 'fgh'],
81  ['iaj', 'klm']
82  ]),
83  $regex = new LUT\Recursive\RegularExpression($map, '/a/'),
84  $iterator = new LUT\Recursive\Iterator($regex)
85  )
86  ->when($result = iterator_to_array($iterator, false))
87  ->then
88  ->array($result)
89  ->isEqualTo([
90  0 => 'abc',
91  1 => 'dea',
92  2 => 'iaj'
93  ]);
94  }
Hoa\Iterator\Test\Unit\RegularExpression::case_recursive_children_flags ( )

Definition at line 96 of file RegularExpression.php.

97  {
98  $this
99  ->given(
100  $map = new LUT\Recursive\Map([
101  ['abc', 'dea', 'fgh'],
102  ['iaj', 'klm']
103  ]),
104  $mode = LUT\Recursive\RegularExpression::ALL_MATCHES,
105  $flag = LUT\Recursive\RegularExpression::USE_KEY,
106  $pregFlag = LUT\Recursive\RegularExpression::ALL_MATCHES,
107  $iterator = new LUT\Recursive\RegularExpression(
108  $map,
109  '/a/',
110  $mode,
111  $flag,
112  $pregFlag
113  )
114  )
115  ->when($result = $iterator->getChildren())
116  ->then
117  ->object($result)
118  ->isInstanceOf('Hoa\Iterator\Recursive\RegularExpression')
119  ->integer($result->getMode())
120  ->isEqualTo($mode)
121  ->integer($result->getFlags())
122  ->isEqualTo($flag)
123  ->integer($result->getPregFlags())
124  ->isEqualTo($pregFlag);
125  }

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