1 | <?php |
||
16 | class Options |
||
17 | { |
||
18 | /** |
||
19 | * The number of processes to run at a time |
||
20 | * |
||
21 | * @var int |
||
22 | */ |
||
23 | protected $processes; |
||
24 | |||
25 | /** |
||
26 | * The test path pointing to tests that will |
||
27 | * be run |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $path; |
||
32 | |||
33 | /** |
||
34 | * The path to the PHPUnit binary that will be run |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $phpunit; |
||
39 | |||
40 | /** |
||
41 | * Determines whether or not ParaTest runs in |
||
42 | * functional mode. If enabled, ParaTest will run |
||
43 | * every test method in a separate process |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $functional; |
||
48 | |||
49 | /** |
||
50 | * Prevents starting new tests after a test has failed. |
||
51 | * |
||
52 | * @var boolean |
||
53 | */ |
||
54 | protected $stopOnFailure; |
||
55 | |||
56 | /** |
||
57 | * A collection of post-processed option values. This is the collection |
||
58 | * containing ParaTest specific options |
||
59 | * |
||
60 | * @var array |
||
61 | */ |
||
62 | protected $filtered; |
||
63 | |||
64 | /** |
||
65 | * A collection of option values directly corresponding |
||
66 | * to certain annotations - i.e group |
||
67 | * |
||
68 | * @var array |
||
69 | */ |
||
70 | protected $annotations = array(); |
||
71 | |||
72 | protected $runner; |
||
73 | protected $noTestTokens; |
||
74 | protected $colors; |
||
75 | protected $testsuite; |
||
76 | protected $maxBatchSize; |
||
77 | protected $filter; |
||
78 | protected $groups; |
||
79 | protected $excludeGroups; |
||
80 | |||
81 | 42 | public function __construct($opts = array()) |
|
118 | |||
119 | /** |
||
120 | * Public read accessibility |
||
121 | * |
||
122 | * @param $var |
||
123 | * @return mixed |
||
124 | */ |
||
125 | 40 | public function __get($var) |
|
129 | |||
130 | /** |
||
131 | * Returns a collection of ParaTest's default |
||
132 | * option values |
||
133 | * |
||
134 | * @return array |
||
135 | */ |
||
136 | 42 | protected static function defaults() |
|
152 | |||
153 | /** |
||
154 | * Get the path to phpunit |
||
155 | * First checks if a Windows batch script is in the composer vendors directory. |
||
156 | * Composer automatically handles creating a .bat file, so if on windows this should be the case. |
||
157 | * Second look for the phpunit binary under nix |
||
158 | * Defaults to phpunit on the users PATH |
||
159 | * @return string $phpunit the path to phpunit |
||
160 | */ |
||
161 | 42 | protected static function phpunit() |
|
177 | |||
178 | /** |
||
179 | * Get the path to the vendor directory |
||
180 | * First assumes vendor directory is accessible from src (i.e development) |
||
181 | * Second assumes vendor directory is accessible within src |
||
182 | */ |
||
183 | 42 | protected static function vendorDir() |
|
192 | |||
193 | /** |
||
194 | * Filter options to distinguish between paratest |
||
195 | * internal options and any other options |
||
196 | * @param array $options |
||
197 | * @return array |
||
198 | */ |
||
199 | 42 | protected function filterOptions($options) |
|
220 | |||
221 | /** |
||
222 | * Take an array of filtered options and return a |
||
223 | * configuration path |
||
224 | * |
||
225 | * @param $filtered |
||
226 | * @return string|null |
||
227 | */ |
||
228 | 42 | protected function getConfigurationPath($filtered) |
|
235 | |||
236 | /** |
||
237 | * Retrieve the default configuration given a path (directory or file). |
||
238 | * This will search into the directory, if a directory is specified |
||
239 | * |
||
240 | * @param string $path The path to search into |
||
241 | * @param string $default The default value to give back |
||
242 | * @return string|null |
||
243 | */ |
||
244 | 42 | private function getDefaultConfigurationForPath($path = '.', $default = null) |
|
260 | |||
261 | /** |
||
262 | * Load options that are represented by annotations |
||
263 | * inside of tests i.e @group group1 = --group group1 |
||
264 | */ |
||
265 | 42 | protected function initAnnotations() |
|
274 | |||
275 | /** |
||
276 | * @param $file |
||
277 | * @return bool |
||
278 | */ |
||
279 | 42 | private function isFile($file) |
|
283 | } |
||
284 |