1 | <?php |
||
13 | class Configuration |
||
14 | { |
||
15 | /** |
||
16 | * Path to the configuration file. |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $path; |
||
21 | |||
22 | /** |
||
23 | * @var \SimpleXMLElement |
||
24 | */ |
||
25 | protected $xml; |
||
26 | |||
27 | protected $availableNodes = ['exclude', 'file', 'directory', 'testsuite']; |
||
28 | |||
29 | /** |
||
30 | * A collection of datastructures |
||
31 | * build from the <testsuite> nodes inside of a |
||
32 | * PHPUnit configuration. |
||
33 | * |
||
34 | * @var array |
||
35 | */ |
||
36 | protected $suites = []; |
||
37 | |||
38 | 59 | public function __construct(string $path) |
|
45 | |||
46 | /** |
||
47 | * Converting the configuration to a string |
||
48 | * returns the configuration path. |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | 3 | public function __toString(): string |
|
56 | |||
57 | /** |
||
58 | * Get the bootstrap PHPUnit configuration attribute. |
||
59 | * |
||
60 | * @return string The bootstrap attribute or empty string if not set |
||
61 | */ |
||
62 | 4 | public function getBootstrap(): string |
|
70 | |||
71 | /** |
||
72 | * Returns the path to the phpunit configuration |
||
73 | * file. |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | 15 | public function getPath(): string |
|
81 | |||
82 | /** |
||
83 | * Return the contents of the <testsuite> nodes |
||
84 | * contained in a PHPUnit configuration. |
||
85 | * |
||
86 | * @return SuitePath[][]|null |
||
87 | */ |
||
88 | 6 | public function getSuites() |
|
102 | |||
103 | /** |
||
104 | * Return the contents of the <testsuite> nodes |
||
105 | * contained in a PHPUnit configuration. |
||
106 | * |
||
107 | * @param string $suiteName |
||
108 | * |
||
109 | * @return SuitePath[]|null |
||
110 | */ |
||
111 | 15 | public function getSuiteByName(string $suiteName) |
|
154 | |||
155 | /** |
||
156 | * Return the path of the directory |
||
157 | * that contains the phpunit configuration. |
||
158 | * |
||
159 | * @return string |
||
160 | */ |
||
161 | 19 | public function getConfigDir(): string |
|
165 | |||
166 | /** |
||
167 | * Returns a suite paths relative to the config file. |
||
168 | * |
||
169 | * @param $path |
||
170 | * |
||
171 | * @return array|string[] |
||
172 | */ |
||
173 | 15 | public function getSuitePaths(string $path) |
|
194 | |||
195 | /** |
||
196 | * Returns true if path needs globbing (like a /path/*-to/string). |
||
197 | * |
||
198 | * @param string $path |
||
199 | * |
||
200 | * @return bool |
||
201 | */ |
||
202 | 2 | public function isGlobRequired(string $path): bool |
|
206 | } |
||
207 |