1 | <?php |
||
7 | class Arguments |
||
8 | { |
||
9 | const APPLICATION_OPTIONS = []; |
||
10 | |||
11 | /** @var string */ |
||
12 | protected $testFile; |
||
13 | protected $phpUnitOptions = []; |
||
14 | protected $applicationOptions = []; |
||
15 | |||
16 | public static function fromString(string $argumentsInput) |
||
20 | |||
21 | public function setTestFile($testFile) |
||
27 | |||
28 | public function setFilter($query) |
||
34 | |||
35 | /** |
||
36 | * Parses a raw arguments string. |
||
37 | * |
||
38 | * The following types of arguments will be parsed: space separated arguments, key/value and boolean arguments, |
||
39 | * and test file name arguments. Space separated arguments are key/value arguments separated by a space. Boolean |
||
40 | * and key/value arguments are regular options that either take no parameters or take a =-separated parameter. |
||
41 | * Test file name arguments are file names (without option flags). |
||
42 | * |
||
43 | * @param $argumentsInput |
||
44 | * @return $this |
||
45 | */ |
||
46 | protected function parse(string $argumentsInput) |
||
81 | |||
82 | /* |
||
83 | * Adds an argument if it does not yet exist, otherwise the argument value is replaced. |
||
84 | * |
||
85 | * In case $value is left empty, the argument will be treated as a boolean option. If the |
||
86 | * name and value are not separated by a space, pass the correct separator as a third |
||
87 | * parameter. |
||
88 | * |
||
89 | * Unless an option is registered (in this class) as an application option, we will assume |
||
90 | * the option is meant to be passed through to PHPUnit. |
||
91 | */ |
||
92 | public function addArgument(string $name, string $value = null, string $separator = '=') |
||
104 | |||
105 | public function phpUnitArguments(): string |
||
120 | |||
121 | public function toArray(): array |
||
131 | |||
132 | |||
133 | |||
134 | protected function parseOption(string $argument) |
||
146 | |||
147 | protected function optionName(string $argument): string |
||
163 | |||
164 | protected function isOption(string $argument): bool |
||
168 | |||
169 | protected function isApplicationOption(string $option): bool |
||
173 | |||
174 | protected function isOptionWithSpaceSeparatedArgument(string $option): bool |
||
178 | } |
||
179 |