1 | <?php |
||
7 | class Arguments |
||
8 | { |
||
9 | use ArgumentAccessors; |
||
10 | |||
11 | const APPLICATION_OPTIONS = []; |
||
12 | |||
13 | /** @var string */ |
||
14 | protected $testFile; |
||
15 | protected $phpUnitOptions = []; |
||
16 | protected $applicationOptions = []; |
||
17 | |||
18 | public static function fromString(string $argumentsInput) |
||
22 | |||
23 | /** |
||
24 | * Parses a raw arguments string. |
||
25 | * |
||
26 | * The following types of arguments will be parsed: space separated arguments, key/value and boolean arguments, |
||
27 | * and test file name arguments. Space separated arguments are key/value arguments separated by a space. Boolean |
||
28 | * and key/value arguments are regular options that either take no parameters or take a =-separated parameter. |
||
29 | * Test file name arguments are file names (without option flags). |
||
30 | * |
||
31 | * @param $argumentsInput |
||
32 | * @return $this |
||
33 | */ |
||
34 | protected function parse(string $argumentsInput) |
||
69 | |||
70 | /* |
||
71 | * Adds an argument if it does not yet exist, otherwise the argument value is replaced. |
||
72 | * |
||
73 | * In case $value is left empty, the argument will be treated as a boolean option. If the |
||
74 | * name and value are not separated by a space, pass the correct separator as a third |
||
75 | * parameter. |
||
76 | * |
||
77 | * Unless an option is registered (in this class) as an application option, we will assume |
||
78 | * the option is meant to be passed through to PHPUnit. |
||
79 | */ |
||
80 | public function addArgument(string $name, string $value = null, string $separator = '=') |
||
92 | |||
93 | public function phpUnitArguments(): string |
||
108 | |||
109 | public function toArray(): array |
||
119 | |||
120 | |||
121 | |||
122 | protected function parseOption(string $argument) |
||
134 | |||
135 | protected function optionName(string $argument): string |
||
151 | |||
152 | protected function isOption(string $argument): bool |
||
156 | |||
157 | protected function isApplicationOption(string $option): bool |
||
161 | |||
162 | protected function isOptionWithSpaceSeparatedArgument(string $option): bool |
||
166 | } |
||
167 |