Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Behat / Output / Node / Printer / Helper / ResultToStringConverter.php
1 <?php
2
3 /*
4  * This file is part of the Behat.
5  * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 namespace Behat\Behat\Output\Node\Printer\Helper;
12
13 use Behat\Behat\Tester\Result\StepResult;
14 use Behat\Testwork\Tester\Result\TestResult;
15
16 /**
17  * Converts result objects into a string representation.
18  *
19  * @author Konstantin Kudryashov <ever.zet@gmail.com>
20  */
21 final class ResultToStringConverter
22 {
23     /**
24      * Converts provided test result to a string.
25      *
26      * @param TestResult $result
27      *
28      * @return string
29      */
30     public function convertResultToString(TestResult $result)
31     {
32         return $this->convertResultCodeToString($result->getResultCode());
33     }
34
35     /**
36      * Converts provided result code to a string.
37      *
38      * @param integer $resultCode
39      *
40      * @return string
41      */
42     public function convertResultCodeToString($resultCode)
43     {
44         switch ($resultCode) {
45             case TestResult::SKIPPED:
46                 return 'skipped';
47             case TestResult::PENDING:
48                 return 'pending';
49             case TestResult::FAILED:
50                 return 'failed';
51             case StepResult::UNDEFINED:
52                 return 'undefined';
53         }
54
55         return 'passed';
56     }
57 }