Hoa central
Public Member Functions | List of all members
Hoa\Ruler\Test\Unit\Model\Operator Class Reference
Inheritance diagram for Hoa\Ruler\Test\Unit\Model\Operator:

Public Member Functions

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

Detailed Description

Class .

Test suite of the operator object of the model.

Definition at line 50 of file Operator.php.

Member Function Documentation

Hoa\Ruler\Test\Unit\Model\Operator::case_lazy_and ( )

Definition at line 52 of file Operator.php.

53  {
54  $this
55  ->given(
56  $ruler = new LUT(),
57  $fExecuted = false,
58  $gExecuted = false,
59  $asserter = $ruler->getDefaultAsserter(),
60  $asserter->setOperator(
61  'f',
62  function ($a = false) use (&$fExecuted) {
63  $fExecuted = true;
64 
65  return $a;
66  }
67  ),
68  $asserter->setOperator(
69  'g',
70  function ($b = false) use (&$gExecuted) {
71  $gExecuted = true;
72 
73  return $b;
74  }
75  ),
76  $rule = 'f(false) and g(true)'
77  )
78  ->when($result = $ruler->assert($rule, new LUT\Context()))
79  ->then
80  ->boolean($result)
81  ->isFalse()
82  ->boolean($fExecuted)
83  ->isTrue()
84  ->boolean($gExecuted)
85  ->isFalse()
86 
87  ->given(
88  $fExecuted = false,
89  $gExecuted = false,
90  $rule = 'f(true) and g(true)'
91  )
92  ->when($result = $ruler->assert($rule, new LUT\Context()))
93  ->then
94  ->boolean($result)
95  ->isTrue()
96  ->boolean($fExecuted)
97  ->isTrue()
98  ->boolean($gExecuted)
99  ->isTrue()
100 
101  ->given(
102  $fExecuted = false,
103  $gExecuted = false,
104  $rule = 'f(true) and g(false)'
105  )
106  ->when($result = $ruler->assert($rule, new LUT\Context()))
107  ->then
108  ->boolean($result)
109  ->isFalse()
110  ->boolean($fExecuted)
111  ->isTrue()
112  ->boolean($gExecuted)
113  ->isTrue()
114 
115  ->given(
116  $fExecuted = false,
117  $gExecuted = false,
118  $rule = 'f(false) and g(false)'
119  )
120  ->when($result = $ruler->assert($rule, new LUT\Context()))
121  ->then
122  ->boolean($result)
123  ->isFalse()
124  ->boolean($fExecuted)
125  ->isTrue()
126  ->boolean($gExecuted)
127  ->isFalse();
128  }
Hoa\Ruler\Test\Unit\Model\Operator::case_lazy_or ( )

Definition at line 130 of file Operator.php.

131  {
132  $this
133  ->given(
134  $ruler = new LUT(),
135  $fExecuted = false,
136  $gExecuted = false,
137  $asserter = $ruler->getDefaultAsserter(),
138  $asserter->setOperator(
139  'f',
140  function ($a) use (&$fExecuted) {
141  $fExecuted = true;
142 
143  return $a;
144  }
145  ),
146  $asserter->setOperator(
147  'g',
148  function ($b) use (&$gExecuted) {
149  $gExecuted = true;
150 
151  return $b;
152  }
153  ),
154  $rule = 'f(false) or g(true)'
155  )
156  ->when($result = $ruler->assert($rule, new LUT\Context()))
157  ->then
158  ->boolean($result)
159  ->isTrue()
160  ->boolean($fExecuted)
161  ->isTrue()
162  ->boolean($gExecuted)
163  ->isTrue()
164 
165  ->given(
166  $fExecuted = false,
167  $gExecuted = false,
168  $rule = 'f(true) or g(true)'
169  )
170  ->when($result = $ruler->assert($rule, new LUT\Context()))
171  ->then
172  ->boolean($result)
173  ->isTrue()
174  ->boolean($fExecuted)
175  ->isTrue()
176  ->boolean($gExecuted)
177  ->isFalse()
178 
179  ->given(
180  $fExecuted = false,
181  $gExecuted = false,
182  $rule = 'f(true) or g(false)'
183  )
184  ->when($result = $ruler->assert($rule, new LUT\Context()))
185  ->then
186  ->boolean($result)
187  ->isTrue()
188  ->boolean($fExecuted)
189  ->isTrue()
190  ->boolean($gExecuted)
191  ->isFalse()
192 
193  ->given(
194  $fExecuted = false,
195  $gExecuted = false,
196  $rule = 'f(false) or g(false)'
197  )
198  ->when($result = $ruler->assert($rule, new LUT\Context()))
199  ->then
200  ->boolean($result)
201  ->isFalse()
202  ->boolean($fExecuted)
203  ->isTrue()
204  ->boolean($gExecuted)
205  ->isTrue();
206  }

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