1 | <?php |
||
26 | class SelfTestResult |
||
27 | { |
||
28 | /** |
||
29 | * Marks error state - dark red. |
||
30 | */ |
||
31 | const STATE_FAIL = 'FAIL'; |
||
32 | |||
33 | /** |
||
34 | * Marks that the test has been skipped/is not applicable in the current environment - lights off. |
||
35 | */ |
||
36 | const STATE_SKIPPED = 'SKIPPED'; |
||
37 | |||
38 | /** |
||
39 | * Marks success state - all lights are green. |
||
40 | */ |
||
41 | const STATE_SUCCESS = 'SUCCESS'; |
||
42 | |||
43 | /** |
||
44 | * Marks a warning state - bright shade of yellow or maybe orange. |
||
45 | */ |
||
46 | const STATE_WARN = 'WARNING'; |
||
47 | |||
48 | /** |
||
49 | * Optional description that could hint any problems and/or explain the error further. |
||
50 | * |
||
51 | * @var string |
||
52 | */ |
||
53 | private $explain; |
||
54 | |||
55 | /** |
||
56 | * The detailed message of the test result. |
||
57 | * |
||
58 | * @var string |
||
59 | */ |
||
60 | private $message; |
||
61 | |||
62 | /** |
||
63 | * The test result state. |
||
64 | * |
||
65 | * @var string |
||
66 | * |
||
67 | * @see SelfTestResult::STATE_FAIL |
||
68 | * @see SelfTestResult::STATE_SKIPPED |
||
69 | * @see SelfTestResult::STATE_SUCCESS |
||
70 | * @see SelfTestResult::STATE_WARN |
||
71 | */ |
||
72 | private $state; |
||
73 | |||
74 | /** |
||
75 | * The implementing class of the test. |
||
76 | * |
||
77 | * @var string |
||
78 | */ |
||
79 | private $testClass; |
||
80 | |||
81 | /** |
||
82 | * Create a new instance. |
||
83 | * |
||
84 | * @param string $message The detailed message of the test result. |
||
85 | * |
||
86 | * @param string $state The test result state. |
||
87 | * |
||
88 | * @param string $testClass The implementing class of the test. |
||
89 | * |
||
90 | * @param string $explain An optional description that could hint any problems. |
||
91 | */ |
||
92 | public function __construct($message, $state, $testClass, $explain = '') |
||
99 | |||
100 | /** |
||
101 | * Retrieve the message describing the test. |
||
102 | * |
||
103 | * @return string |
||
104 | */ |
||
105 | public function getMessage() |
||
109 | |||
110 | /** |
||
111 | * Retrieve the result state. |
||
112 | * |
||
113 | * @return string |
||
114 | */ |
||
115 | public function getState() |
||
119 | |||
120 | /** |
||
121 | * Retrieve the class name that has created this test result. |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | public function getTestClass() |
||
129 | |||
130 | /** |
||
131 | * Retrieve the optional explanation. |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | public function getExplain() |
||
139 | } |
||
140 |