1 | <?php |
||
26 | class Options |
||
27 | { |
||
28 | /** |
||
29 | * The number of processes to run at a time |
||
30 | * |
||
31 | * @var int |
||
32 | */ |
||
33 | protected $processes; |
||
34 | |||
35 | /** |
||
36 | * The test path pointing to tests that will |
||
37 | * be run |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $path; |
||
42 | |||
43 | /** |
||
44 | * The path to the PHPUnit binary that will be run |
||
45 | * |
||
46 | * @var string |
||
47 | */ |
||
48 | protected $phpunit; |
||
49 | |||
50 | /** |
||
51 | * Determines whether or not ParaTest runs in |
||
52 | * functional mode. If enabled, ParaTest will run |
||
53 | * every test method in a separate process |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | protected $functional; |
||
58 | |||
59 | /** |
||
60 | * Prevents starting new tests after a test has failed. |
||
61 | * |
||
62 | * @var boolean |
||
63 | */ |
||
64 | protected $stopOnFailure; |
||
65 | |||
66 | /** |
||
67 | * A collection of post-processed option values. This is the collection |
||
68 | * containing ParaTest specific options |
||
69 | * |
||
70 | * @var array |
||
71 | */ |
||
72 | protected $filtered; |
||
73 | |||
74 | /** |
||
75 | * A collection of option values directly corresponding |
||
76 | * to certain annotations - i.e group |
||
77 | * |
||
78 | * @var array |
||
79 | */ |
||
80 | protected $annotations = array(); |
||
81 | |||
82 | protected $runner; |
||
83 | protected $noTestTokens; |
||
84 | protected $colors; |
||
85 | protected $testsuite; |
||
86 | protected $maxBatchSize; |
||
87 | protected $filter; |
||
88 | protected $groups; |
||
89 | protected $excludeGroups; |
||
90 | |||
91 | 42 | public function __construct($opts = array()) |
|
128 | |||
129 | /** |
||
130 | * Public read accessibility |
||
131 | * |
||
132 | * @param $var |
||
133 | * @return mixed |
||
134 | */ |
||
135 | 40 | public function __get($var) |
|
139 | |||
140 | /** |
||
141 | * Returns a collection of ParaTest's default |
||
142 | * option values |
||
143 | * |
||
144 | * @return array |
||
145 | */ |
||
146 | 42 | protected static function defaults() |
|
162 | |||
163 | /** |
||
164 | * Get the path to phpunit |
||
165 | * First checks if a Windows batch script is in the composer vendors directory. |
||
166 | * Composer automatically handles creating a .bat file, so if on windows this should be the case. |
||
167 | * Second look for the phpunit binary under nix |
||
168 | * Defaults to phpunit on the users PATH |
||
169 | * @return string $phpunit the path to phpunit |
||
170 | */ |
||
171 | 42 | protected static function phpunit() |
|
187 | |||
188 | /** |
||
189 | * Get the path to the vendor directory |
||
190 | * First assumes vendor directory is accessible from src (i.e development) |
||
191 | * Second assumes vendor directory is accessible within src |
||
192 | */ |
||
193 | 42 | protected static function vendorDir() |
|
202 | |||
203 | /** |
||
204 | * Filter options to distinguish between paratest |
||
205 | * internal options and any other options |
||
206 | * @param array $options |
||
207 | * @return array |
||
208 | */ |
||
209 | 42 | protected function filterOptions($options) |
|
230 | |||
231 | /** |
||
232 | * Take an array of filtered options and return a |
||
233 | * configuration path |
||
234 | * |
||
235 | * @param $filtered |
||
236 | * @return string|null |
||
237 | */ |
||
238 | 42 | protected function getConfigurationPath($filtered) |
|
245 | |||
246 | /** |
||
247 | * Retrieve the default configuration given a path (directory or file). |
||
248 | * This will search into the directory, if a directory is specified |
||
249 | * |
||
250 | * @param string $path The path to search into |
||
251 | * @param string $default The default value to give back |
||
252 | * @return string|null |
||
253 | */ |
||
254 | 42 | private function getDefaultConfigurationForPath($path = '.', $default = null) |
|
270 | |||
271 | /** |
||
272 | * Load options that are represented by annotations |
||
273 | * inside of tests i.e @group group1 = --group group1 |
||
274 | */ |
||
275 | 42 | protected function initAnnotations() |
|
284 | |||
285 | /** |
||
286 | * @param $file |
||
287 | * @return bool |
||
288 | */ |
||
289 | 42 | private function isFile($file) |
|
293 | } |
||
294 |