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