| Conditions | 4 |
| Paths | 6 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function evaluate(array $expectations, OutcomeInterface $outcome): array |
||
| 25 | { |
||
| 26 | $statuses = []; |
||
| 27 | $isHandled = !$outcome->mustBeHandled(); |
||
| 28 | |||
| 29 | foreach ($expectations as $index => $expectation) { |
||
| 30 | if ($expectation->handles($outcome)) { |
||
| 31 | $statuses[$index] = $expectation->handle($outcome); |
||
| 32 | $isHandled = true; |
||
| 33 | } else { |
||
| 34 | $statuses[$index] = new Failure("Failed $expectation"); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | if (!$isHandled) { |
||
| 39 | $statuses[] = new Failure("Unhandled $outcome"); |
||
| 40 | } |
||
| 41 | |||
| 42 | return $statuses; |
||
| 43 | } |
||
| 45 |