1 | <?php |
||
5 | final class TestResult |
||
6 | { |
||
7 | /** |
||
8 | * @var string Test category this test belongs to |
||
9 | */ |
||
10 | private $category; |
||
11 | |||
12 | /** |
||
13 | * @var string The subject that was tested |
||
14 | */ |
||
15 | private $subject; |
||
16 | |||
17 | /** |
||
18 | * @var string Message describing the result |
||
19 | */ |
||
20 | private $message; |
||
21 | |||
22 | /** |
||
23 | * @var array Data to be used by TestSuite or other TestCases |
||
24 | */ |
||
25 | private $output; |
||
26 | |||
27 | /** |
||
28 | * @var State The State object reflecting the result |
||
29 | */ |
||
30 | private $state = State::NOSTATE; |
||
31 | |||
32 | |||
33 | /** |
||
34 | * @param string $category |
||
35 | * @param string $subject |
||
36 | */ |
||
37 | public function __construct($category = 'Unknown category', $subject = 'Unknown subject') |
||
43 | |||
44 | |||
45 | /** |
||
46 | * @param string $subject |
||
47 | * |
||
48 | * @return void |
||
49 | */ |
||
50 | public function setSubject($subject) |
||
55 | |||
56 | |||
57 | /** |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getSubject() |
||
65 | |||
66 | |||
67 | /** |
||
68 | * @param string $category |
||
69 | * |
||
70 | * @return void |
||
71 | */ |
||
72 | public function setCategory($category) |
||
77 | |||
78 | |||
79 | /** |
||
80 | * @return string |
||
81 | */ |
||
82 | public function getCategory() |
||
87 | |||
88 | |||
89 | /** |
||
90 | * @param string $message |
||
91 | * |
||
92 | * @return void |
||
93 | */ |
||
94 | public function setMessage($message) |
||
99 | |||
100 | |||
101 | /** |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getMessage() |
||
109 | |||
110 | |||
111 | /** |
||
112 | * @param array $value |
||
113 | * |
||
114 | * @return void |
||
115 | */ |
||
116 | public function setOutput($value) |
||
121 | |||
122 | |||
123 | /** |
||
124 | * @param mixed $value |
||
125 | * @param string|null $index |
||
126 | * |
||
127 | * @return void |
||
128 | */ |
||
129 | protected function addOutput($value, $index = null) |
||
137 | |||
138 | |||
139 | /** |
||
140 | * @param string|null $key |
||
141 | * |
||
142 | * @return mixed |
||
143 | */ |
||
144 | public function getOutput($key = null) |
||
149 | |||
150 | |||
151 | /** |
||
152 | * @param State $state |
||
153 | * |
||
154 | * @return void |
||
155 | */ |
||
156 | public function setState($state = State::NOSTATE) |
||
161 | |||
162 | |||
163 | /** |
||
164 | * @return State |
||
165 | */ |
||
166 | public function getState() |
||
171 | } |
||
172 |