1 | <?php |
||
12 | class TestResult |
||
13 | { |
||
14 | use HasEventEmitterTrait; |
||
15 | |||
16 | /** |
||
17 | * Tracks total tests run against this result |
||
18 | * |
||
19 | * @var int |
||
20 | */ |
||
21 | protected $testCount = 0; |
||
22 | |||
23 | /** |
||
24 | * Tracks total number of failed tests run against this result |
||
25 | * |
||
26 | * @var int |
||
27 | */ |
||
28 | protected $failureCount = 0; |
||
29 | |||
30 | /** |
||
31 | * Tracks total number of pending tests run against this result |
||
32 | * |
||
33 | * @var int |
||
34 | */ |
||
35 | protected $pendingCount = 0; |
||
36 | |||
37 | /** |
||
38 | * True if focused specs were configured via DSL functions |
||
39 | * |
||
40 | * @var bool |
||
41 | */ |
||
42 | protected $isFocusedByDsl = false; |
||
43 | |||
44 | /** |
||
45 | * @param EventEmitterInterface $eventEmitter |
||
46 | */ |
||
47 | public function __construct(EventEmitterInterface $eventEmitter) |
||
51 | |||
52 | /** |
||
53 | * Returns a summary string containing total tests run and total tests |
||
54 | * failed |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getSummary() |
||
67 | |||
68 | /** |
||
69 | * Fail the given test. |
||
70 | * |
||
71 | * @param TestInterface $test |
||
72 | * @param mixed $exception |
||
73 | */ |
||
74 | public function failTest(TestInterface $test, $exception) |
||
79 | |||
80 | /** |
||
81 | * Notify result that test is pending |
||
82 | * |
||
83 | * @param TestInterface $test |
||
84 | */ |
||
85 | public function pendTest(TestInterface $test) |
||
90 | |||
91 | /** |
||
92 | * Pass the given test. |
||
93 | * |
||
94 | * @param TestInterface $test |
||
95 | */ |
||
96 | public function passTest(TestInterface $test) |
||
100 | |||
101 | /** |
||
102 | * Increment test count and emit start event |
||
103 | * |
||
104 | * @param TestInterface $test |
||
105 | */ |
||
106 | public function startTest(TestInterface $test) |
||
111 | |||
112 | /** |
||
113 | * Emit end event for a test |
||
114 | * |
||
115 | * @param TestInterface $test |
||
116 | */ |
||
117 | public function endTest(TestInterface $test) |
||
121 | |||
122 | /** |
||
123 | * Get the number of failures tracked by this result. |
||
124 | * |
||
125 | * @return int |
||
126 | */ |
||
127 | public function getFailureCount() |
||
131 | |||
132 | /** |
||
133 | * Set the number of failures tracked by this result. |
||
134 | * |
||
135 | * @param int $failureCount |
||
136 | */ |
||
137 | public function setFailureCount($failureCount) |
||
142 | |||
143 | /** |
||
144 | * Get the number of tests tracked by this |
||
145 | * result. |
||
146 | * |
||
147 | * @return int |
||
148 | */ |
||
149 | public function getTestCount() |
||
153 | |||
154 | /** |
||
155 | * Set the number of tests tracked by this |
||
156 | * result. |
||
157 | * |
||
158 | * @param int $testCount |
||
159 | */ |
||
160 | public function setTestCount($testCount) |
||
165 | |||
166 | /** |
||
167 | * Get the number of pending tests tracked |
||
168 | * by this test result. |
||
169 | * |
||
170 | * @return int |
||
171 | */ |
||
172 | public function getPendingCount() |
||
176 | |||
177 | /** |
||
178 | * Set the number of pending tests tracked |
||
179 | * by this test result. |
||
180 | * |
||
181 | * @param int $pendingCount |
||
182 | */ |
||
183 | public function setPendingCount($pendingCount) |
||
188 | |||
189 | /** |
||
190 | * Returns true if focused specs were configured via DSL functions |
||
191 | * |
||
192 | * @return bool |
||
193 | */ |
||
194 | public function isFocusedByDsl() |
||
198 | |||
199 | /** |
||
200 | * Mark this result as having focused specs configured via DSL functions |
||
201 | * |
||
202 | * @param bool $isFocusedByDsl |
||
203 | */ |
||
204 | public function setIsFocusedByDsl($isFocusedByDsl) |
||
209 | } |
||
210 |