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