1 | <?php |
||
12 | class Configuration |
||
13 | { |
||
14 | /** |
||
15 | * Path to the configuration file |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $path; |
||
20 | |||
21 | /** |
||
22 | * @var \SimpleXMLElement |
||
23 | */ |
||
24 | protected $xml; |
||
25 | |||
26 | protected $availableNodes = ['exclude', 'file', 'directory', 'testsuite']; |
||
27 | |||
28 | /** |
||
29 | * A collection of datastructures |
||
30 | * build from the <testsuite> nodes inside of a |
||
31 | * PHPUnit configuration |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $suites = []; |
||
36 | |||
37 | 59 | public function __construct($path) |
|
44 | |||
45 | /** |
||
46 | * Get the bootstrap PHPUnit configuration attribute |
||
47 | * |
||
48 | * @return string The bootstrap attribute or empty string if not set |
||
49 | */ |
||
50 | 4 | public function getBootstrap() |
|
58 | |||
59 | /** |
||
60 | * Returns the path to the phpunit configuration |
||
61 | * file |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | 15 | public function getPath() |
|
69 | |||
70 | /** |
||
71 | * Return the contents of the <testsuite> nodes |
||
72 | * contained in a PHPUnit configuration |
||
73 | * |
||
74 | * @return SuitePath[][]|null |
||
75 | */ |
||
76 | 6 | public function getSuites() |
|
89 | |||
90 | /** |
||
91 | * Return the contents of the <testsuite> nodes |
||
92 | * contained in a PHPUnit configuration |
||
93 | * |
||
94 | * @param string $suiteName |
||
95 | * |
||
96 | * @return SuitePath[]|null |
||
97 | */ |
||
98 | 15 | public function getSuiteByName($suiteName) |
|
141 | |||
142 | /** |
||
143 | * Return the path of the directory |
||
144 | * that contains the phpunit configuration |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | 19 | public function getConfigDir() |
|
152 | |||
153 | /** |
||
154 | * Returns a suite paths relative to the config file |
||
155 | * |
||
156 | * @param $path |
||
157 | * @return array|string[] |
||
158 | */ |
||
159 | 15 | public function getSuitePaths($path) |
|
179 | |||
180 | /** |
||
181 | * Returns true if path needs globbing (like a /path/*-to/string) |
||
182 | * |
||
183 | * @param string $path |
||
184 | * @return bool |
||
185 | */ |
||
186 | 2 | public function isGlobRequired($path) |
|
190 | |||
191 | /** |
||
192 | * Converting the configuration to a string |
||
193 | * returns the configuration path |
||
194 | * |
||
195 | * @return string |
||
196 | */ |
||
197 | 3 | public function __toString() |
|
201 | } |
||
202 |