1 | <?php |
||
10 | class Configuration |
||
11 | { |
||
12 | /** |
||
13 | * @var boolean |
||
14 | */ |
||
15 | protected $colorsEnabled = true; |
||
16 | |||
17 | /** |
||
18 | * @var boolean |
||
19 | */ |
||
20 | protected $colorsEnableExplicit = false; |
||
21 | |||
22 | /** |
||
23 | * @var string|null |
||
24 | */ |
||
25 | protected $focusPattern; |
||
26 | |||
27 | /** |
||
28 | * @var string|null |
||
29 | */ |
||
30 | protected $skipPattern; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $grep = '*.spec.php'; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $reporter = 'spec'; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $path; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $configurationFile; |
||
51 | |||
52 | /** |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $dsl; |
||
56 | |||
57 | /** |
||
58 | * @var bool |
||
59 | */ |
||
60 | protected $stopOnFailure = false; |
||
61 | |||
62 | public function __construct() |
||
68 | |||
69 | /** |
||
70 | * Set the pattern used to load tests |
||
71 | * |
||
72 | * @param string $grep |
||
73 | * @return $this |
||
74 | */ |
||
75 | public function setGrep($grep) |
||
79 | |||
80 | /** |
||
81 | * Returns the pattern used to load tests |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getGrep() |
||
89 | |||
90 | /** |
||
91 | * Set the pattern used to focus tests |
||
92 | * |
||
93 | * @param string|null $pattern |
||
94 | * @return $this |
||
95 | */ |
||
96 | public function setFocusPattern($pattern) |
||
100 | |||
101 | /** |
||
102 | * Returns the pattern used to focus tests |
||
103 | * |
||
104 | * @return string|null |
||
105 | */ |
||
106 | public function getFocusPattern() |
||
110 | |||
111 | /** |
||
112 | * Set the pattern used to skip tests |
||
113 | * |
||
114 | * @param string|null $pattern |
||
115 | * @return $this |
||
116 | */ |
||
117 | public function setSkipPattern($pattern) |
||
121 | |||
122 | /** |
||
123 | * Returns the pattern used to skip tests |
||
124 | * |
||
125 | * @return string|null |
||
126 | */ |
||
127 | public function getSkipPattern() |
||
131 | |||
132 | /** |
||
133 | * Set the name of the reporter to use |
||
134 | * |
||
135 | * @param string $reporter |
||
136 | * @return $this |
||
137 | */ |
||
138 | public function setReporter($reporter) |
||
142 | |||
143 | /** |
||
144 | * Return the name of the reporter configured for use |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | public function getReporter() |
||
152 | |||
153 | /** |
||
154 | * Set the path to load tests from |
||
155 | * |
||
156 | * @param string $path |
||
157 | * @return $this |
||
158 | */ |
||
159 | public function setPath($path) |
||
163 | |||
164 | /** |
||
165 | * Return the path being searched for tests |
||
166 | * |
||
167 | * @return string |
||
168 | */ |
||
169 | public function getPath() |
||
173 | |||
174 | /** |
||
175 | * Disable output colors |
||
176 | * |
||
177 | * @return $this |
||
178 | */ |
||
179 | public function disableColors() |
||
187 | |||
188 | /** |
||
189 | * Force output colors even without TTY support. |
||
190 | * |
||
191 | * @return $this |
||
192 | */ |
||
193 | public function enableColorsExplicit() |
||
199 | |||
200 | /** |
||
201 | * Check if output colors are disabled |
||
202 | * |
||
203 | * @return boolean |
||
204 | */ |
||
205 | public function areColorsEnabled() |
||
209 | |||
210 | /** |
||
211 | * Check if output colors are explicitly enabled. |
||
212 | * |
||
213 | * @return boolean |
||
214 | */ |
||
215 | public function areColorsEnabledExplicit() |
||
219 | |||
220 | /** |
||
221 | * Stop the suite runner when a failure occurs |
||
222 | * |
||
223 | * @return $this |
||
224 | */ |
||
225 | public function stopOnFailure() |
||
229 | |||
230 | /** |
||
231 | * Check if the suite runner should stop on failure |
||
232 | * |
||
233 | * @return bool |
||
234 | */ |
||
235 | public function shouldStopOnFailure() |
||
239 | |||
240 | /** |
||
241 | * Set the path to a Peridot configuration file |
||
242 | * |
||
243 | * @param string $configurationFile |
||
244 | * @return $this |
||
245 | */ |
||
246 | public function setConfigurationFile($configurationFile) |
||
259 | |||
260 | /** |
||
261 | * Return the path to the Peridot configuration file. Returns a relative |
||
262 | * path if it exists, otherwise return the provided value |
||
263 | * |
||
264 | * @return string |
||
265 | */ |
||
266 | public function getConfigurationFile() |
||
270 | |||
271 | /** |
||
272 | * Set the path to a DSL file for defining |
||
273 | * the test language used |
||
274 | * |
||
275 | * @param string $dsl |
||
276 | * @return $this |
||
277 | */ |
||
278 | public function setDsl($dsl) |
||
282 | |||
283 | /** |
||
284 | * Get the path to a DSL file containing |
||
285 | * test functions to use |
||
286 | * |
||
287 | * @return string |
||
288 | */ |
||
289 | public function getDsl() |
||
293 | |||
294 | /** |
||
295 | * Write a configuration value and persist it to the current |
||
296 | * environment. |
||
297 | * |
||
298 | * @param $varName |
||
299 | * @param $value |
||
300 | * @return $this |
||
301 | */ |
||
302 | protected function write($varName, $value) |
||
310 | } |
||
311 |