4 * This file is part of the Behat.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Testwork\Tester\Result;
13 use Behat\Testwork\Tester\Result\Interpretation\ResultInterpretation;
16 * Interprets provided test result (as 1 or 0) using registered interpretations.
18 * @author Konstantin Kudryashov <ever.zet@gmail.com>
20 final class ResultInterpreter
23 * @var ResultInterpretation[]
25 private $interpretations = array();
28 * Registers result interpretation.
30 * @param ResultInterpretation $interpretation
32 public function registerResultInterpretation(ResultInterpretation $interpretation)
34 $this->interpretations[] = $interpretation;
38 * Interprets result as a UNIX return code (0 for success, 1 for failure).
40 * @param TestResult $result
44 public function interpretResult(TestResult $result)
46 foreach ($this->interpretations as $interpretation) {
47 if ($interpretation->isFailure($result)) {