1 | <?php |
||
19 | final class TestResult |
||
20 | { |
||
21 | public const FAIL = 'failed'; |
||
22 | public const SKIPPED = 'skipped'; |
||
23 | public const INCOMPLETE = 'incompleted'; |
||
24 | public const RISKY = 'risked'; |
||
25 | public const WARN = 'warnings'; |
||
26 | public const RUNS = 'pending'; |
||
27 | public const PASS = 'passed'; |
||
28 | |||
29 | /** |
||
30 | * @readonly |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | public $description; |
||
35 | |||
36 | /** |
||
37 | * @readonly |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | public $type; |
||
42 | |||
43 | /** |
||
44 | * @readonly |
||
45 | * |
||
46 | * @var string |
||
47 | */ |
||
48 | public $icon; |
||
49 | |||
50 | /** |
||
51 | * @readonly |
||
52 | * |
||
53 | * @var string |
||
54 | */ |
||
55 | public $color; |
||
56 | |||
57 | /** |
||
58 | * @readonly |
||
59 | * |
||
60 | * @var null|string |
||
61 | */ |
||
62 | public $warning; |
||
63 | |||
64 | /** |
||
65 | * Test constructor. |
||
66 | * |
||
67 | * @param string $description |
||
68 | * @param string $type |
||
69 | * @param string $icon |
||
70 | * @param string $color |
||
71 | * @param string $warning |
||
72 | */ |
||
73 | private function __construct(string $description, string $type, string $icon, string $color, string $warning = null) |
||
81 | |||
82 | /** |
||
83 | * Creates a new test from the given test case. |
||
84 | * |
||
85 | * @param TestCase $testCase |
||
86 | * |
||
87 | * @return self |
||
88 | */ |
||
89 | public static function fromTestCase(TestCase $testCase, string $type, string $warning = null): self |
||
99 | |||
100 | /** |
||
101 | * Get the test case description. |
||
102 | * |
||
103 | * @return string |
||
104 | */ |
||
105 | public static function makeDescription(TestCase $testCase): string |
||
124 | |||
125 | /** |
||
126 | * Get the test case icon. |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | public static function makeIcon(string $type): string |
||
149 | |||
150 | /** |
||
151 | * Get the test case color. |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | public static function makeColor(string $type): string |
||
170 | } |
||
171 |