3 * This file is part of PHPUnit.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * Wrapper for the PHPUnit XML configuration file.
14 * Example XML configuration file:
16 * <?xml version="1.0" encoding="utf-8" ?>
18 * <phpunit backupGlobals="true"
19 * backupStaticAttributes="false"
20 * bootstrap="/path/to/bootstrap.php"
25 * convertErrorsToExceptions="true"
26 * convertNoticesToExceptions="true"
27 * convertWarningsToExceptions="true"
28 * forceCoversAnnotation="false"
29 * mapTestClassNameToCoveredClassName="false"
30 * printerClass="PHPUnit_TextUI_ResultPrinter"
31 * processIsolation="false"
33 * stopOnFailure="false"
34 * stopOnIncomplete="false"
36 * stopOnSkipped="false"
37 * testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"
38 * timeoutForSmallTests="1"
39 * timeoutForMediumTests="10"
40 * timeoutForLargeTests="60"
41 * beStrictAboutTestsThatDoNotTestAnything="false"
42 * beStrictAboutOutputDuringTests="false"
43 * beStrictAboutTestSize="false"
44 * beStrictAboutTodoAnnotatedTests="false"
45 * checkForUnintentionallyCoveredCode="false"
46 * disallowChangesToGlobalState="false"
49 * <testsuite name="My Test Suite">
50 * <directory suffix="Test.php" phpVersion="5.3.0" phpVersionOperator=">=">/path/to/files</directory>
51 * <file phpVersion="5.3.0" phpVersionOperator=">=">/path/to/MyTest.php</file>
52 * <exclude>/path/to/files/exclude</exclude>
67 * <directory suffix=".php">/path/to/files</directory>
68 * <file>/path/to/file</file>
70 * <directory suffix=".php">/path/to/files</directory>
71 * <file>/path/to/file</file>
74 * <whitelist addUncoveredFilesFromWhitelist="true"
75 * processUncoveredFilesFromWhitelist="false">
76 * <directory suffix=".php">/path/to/files</directory>
77 * <file>/path/to/file</file>
79 * <directory suffix=".php">/path/to/files</directory>
80 * <file>/path/to/file</file>
86 * <listener class="MyListener" file="/optional/path/to/MyListener.php">
90 * <string>Sebastian</string>
93 * <integer>22</integer>
94 * <string>April</string>
95 * <double>19.78</double>
97 * <object class="stdClass"/>
98 * <file>MyRelativeFile.php</file>
99 * <directory>MyRelativeDir</directory>
105 * <log type="coverage-html" target="/tmp/report" lowUpperBound="50" highLowerBound="90"/>
106 * <log type="coverage-clover" target="/tmp/clover.xml"/>
107 * <log type="coverage-crap4j" target="/tmp/crap.xml" threshold="30"/>
108 * <log type="json" target="/tmp/logfile.json"/>
109 * <log type="plain" target="/tmp/logfile.txt"/>
110 * <log type="tap" target="/tmp/logfile.tap"/>
111 * <log type="junit" target="/tmp/logfile.xml" logIncompleteSkipped="false"/>
112 * <log type="testdox-html" target="/tmp/testdox.html"/>
113 * <log type="testdox-text" target="/tmp/testdox.txt"/>
117 * <includePath>.</includePath>
118 * <ini name="foo" value="bar"/>
119 * <const name="foo" value="bar"/>
120 * <var name="foo" value="bar"/>
121 * <env name="foo" value="bar"/>
122 * <post name="foo" value="bar"/>
123 * <get name="foo" value="bar"/>
124 * <cookie name="foo" value="bar"/>
125 * <server name="foo" value="bar"/>
126 * <files name="foo" value="bar"/>
127 * <request name="foo" value="bar"/>
131 * <browser name="Firefox on Linux"
132 * browser="*firefox /usr/lib/firefox/firefox-bin"
133 * host="my.linux.box"
140 * @since Class available since Release 3.2.0
142 class PHPUnit_Util_Configuration
144 private static $instances = array();
151 * Loads a PHPUnit configuration file.
153 * @param string $filename
155 protected function __construct($filename)
157 $this->filename = $filename;
158 $this->document = PHPUnit_Util_XML::loadFile($filename, false, true, true);
159 $this->xpath = new DOMXPath($this->document);
163 * @since Method available since Release 3.4.0
165 final private function __clone()
170 * Returns a PHPUnit configuration object.
172 * @param string $filename
174 * @return PHPUnit_Util_Configuration
176 * @since Method available since Release 3.4.0
178 public static function getInstance($filename)
180 $realpath = realpath($filename);
182 if ($realpath === false) {
183 throw new PHPUnit_Framework_Exception(
185 'Could not read "%s".',
191 if (!isset(self::$instances[$realpath])) {
192 self::$instances[$realpath] = new self($realpath);
195 return self::$instances[$realpath];
199 * Returns the realpath to the configuration file.
203 * @since Method available since Release 3.6.0
205 public function getFilename()
207 return $this->filename;
211 * Returns the configuration for SUT filtering.
215 * @since Method available since Release 3.2.1
217 public function getFilterConfiguration()
219 $addUncoveredFilesFromWhitelist = true;
220 $processUncoveredFilesFromWhitelist = false;
222 $tmp = $this->xpath->query('filter/whitelist');
224 if ($tmp->length == 1) {
225 if ($tmp->item(0)->hasAttribute('addUncoveredFilesFromWhitelist')) {
226 $addUncoveredFilesFromWhitelist = $this->getBoolean(
227 (string) $tmp->item(0)->getAttribute(
228 'addUncoveredFilesFromWhitelist'
234 if ($tmp->item(0)->hasAttribute('processUncoveredFilesFromWhitelist')) {
235 $processUncoveredFilesFromWhitelist = $this->getBoolean(
236 (string) $tmp->item(0)->getAttribute(
237 'processUncoveredFilesFromWhitelist'
245 'blacklist' => array(
247 'directory' => $this->readFilterDirectories(
248 'filter/blacklist/directory'
250 'file' => $this->readFilterFiles(
251 'filter/blacklist/file'
255 'directory' => $this->readFilterDirectories(
256 'filter/blacklist/exclude/directory'
258 'file' => $this->readFilterFiles(
259 'filter/blacklist/exclude/file'
263 'whitelist' => array(
264 'addUncoveredFilesFromWhitelist' => $addUncoveredFilesFromWhitelist,
265 'processUncoveredFilesFromWhitelist' => $processUncoveredFilesFromWhitelist,
267 'directory' => $this->readFilterDirectories(
268 'filter/whitelist/directory'
270 'file' => $this->readFilterFiles(
271 'filter/whitelist/file'
275 'directory' => $this->readFilterDirectories(
276 'filter/whitelist/exclude/directory'
278 'file' => $this->readFilterFiles(
279 'filter/whitelist/exclude/file'
287 * Returns the configuration for groups.
291 * @since Method available since Release 3.2.1
293 public function getGroupConfiguration()
296 'include' => array(),
300 foreach ($this->xpath->query('groups/include/group') as $group) {
301 $groups['include'][] = (string) $group->textContent;
304 foreach ($this->xpath->query('groups/exclude/group') as $group) {
305 $groups['exclude'][] = (string) $group->textContent;
312 * Returns the configuration for listeners.
316 * @since Method available since Release 3.4.0
318 public function getListenerConfiguration()
322 foreach ($this->xpath->query('listeners/listener') as $listener) {
323 $class = (string) $listener->getAttribute('class');
325 $arguments = array();
327 if ($listener->getAttribute('file')) {
328 $file = $this->toAbsolutePath(
329 (string) $listener->getAttribute('file'),
334 foreach ($listener->childNodes as $node) {
335 if ($node instanceof DOMElement && $node->tagName == 'arguments') {
336 foreach ($node->childNodes as $argument) {
337 if ($argument instanceof DOMElement) {
338 if ($argument->tagName == 'file' ||
339 $argument->tagName == 'directory') {
340 $arguments[] = $this->toAbsolutePath((string) $argument->textContent);
342 $arguments[] = PHPUnit_Util_XML::xmlToVariable($argument);
352 'arguments' => $arguments
360 * Returns the logging configuration.
364 public function getLoggingConfiguration()
368 foreach ($this->xpath->query('logging/log') as $log) {
369 $type = (string) $log->getAttribute('type');
370 $target = (string) $log->getAttribute('target');
376 $target = $this->toAbsolutePath($target);
378 if ($type == 'coverage-html') {
379 if ($log->hasAttribute('lowUpperBound')) {
380 $result['lowUpperBound'] = $this->getInteger(
381 (string) $log->getAttribute('lowUpperBound'),
386 if ($log->hasAttribute('highLowerBound')) {
387 $result['highLowerBound'] = $this->getInteger(
388 (string) $log->getAttribute('highLowerBound'),
392 } elseif ($type == 'coverage-crap4j') {
393 if ($log->hasAttribute('threshold')) {
394 $result['crap4jThreshold'] = $this->getInteger(
395 (string) $log->getAttribute('threshold'),
399 } elseif ($type == 'junit') {
400 if ($log->hasAttribute('logIncompleteSkipped')) {
401 $result['logIncompleteSkipped'] = $this->getBoolean(
402 (string) $log->getAttribute('logIncompleteSkipped'),
406 } elseif ($type == 'coverage-text') {
407 if ($log->hasAttribute('showUncoveredFiles')) {
408 $result['coverageTextShowUncoveredFiles'] = $this->getBoolean(
409 (string) $log->getAttribute('showUncoveredFiles'),
413 if ($log->hasAttribute('showOnlySummary')) {
414 $result['coverageTextShowOnlySummary'] = $this->getBoolean(
415 (string) $log->getAttribute('showOnlySummary'),
421 $result[$type] = $target;
428 * Returns the PHP configuration.
432 * @since Method available since Release 3.2.1
434 public function getPHPConfiguration()
437 'include_path' => array(),
450 foreach ($this->xpath->query('php/includePath') as $includePath) {
451 $path = (string) $includePath->textContent;
453 $result['include_path'][] = $this->toAbsolutePath($path);
457 foreach ($this->xpath->query('php/ini') as $ini) {
458 $name = (string) $ini->getAttribute('name');
459 $value = (string) $ini->getAttribute('value');
461 $result['ini'][$name] = $value;
464 foreach ($this->xpath->query('php/const') as $const) {
465 $name = (string) $const->getAttribute('name');
466 $value = (string) $const->getAttribute('value');
468 $result['const'][$name] = $this->getBoolean($value, $value);
471 foreach (array('var', 'env', 'post', 'get', 'cookie', 'server', 'files', 'request') as $array) {
472 foreach ($this->xpath->query('php/' . $array) as $var) {
473 $name = (string) $var->getAttribute('name');
474 $value = (string) $var->getAttribute('value');
476 $result[$array][$name] = $this->getBoolean($value, $value);
484 * Handles the PHP configuration.
486 * @since Method available since Release 3.2.20
488 public function handlePHPConfiguration()
490 $configuration = $this->getPHPConfiguration();
492 if (! empty($configuration['include_path'])) {
495 implode(PATH_SEPARATOR, $configuration['include_path']) .
497 ini_get('include_path')
501 foreach ($configuration['ini'] as $name => $value) {
502 if (defined($value)) {
503 $value = constant($value);
506 ini_set($name, $value);
509 foreach ($configuration['const'] as $name => $value) {
510 if (!defined($name)) {
511 define($name, $value);
515 foreach (array('var', 'post', 'get', 'cookie', 'server', 'files', 'request') as $array) {
516 // See https://github.com/sebastianbergmann/phpunit/issues/277
527 $target = &$GLOBALS['_' . strtoupper($array)];
531 foreach ($configuration[$array] as $name => $value) {
532 $target[$name] = $value;
536 foreach ($configuration['env'] as $name => $value) {
537 if (false === getenv($name)) {
538 putenv("{$name}={$value}");
540 if (!isset($_ENV[$name])) {
541 $_ENV[$name] = $value;
547 * Returns the PHPUnit configuration.
551 * @since Method available since Release 3.2.14
553 public function getPHPUnitConfiguration()
556 $root = $this->document->documentElement;
558 if ($root->hasAttribute('cacheTokens')) {
559 $result['cacheTokens'] = $this->getBoolean(
560 (string) $root->getAttribute('cacheTokens'),
565 if ($root->hasAttribute('columns')) {
566 $columns = (string) $root->getAttribute('columns');
568 if ($columns == 'max') {
569 $result['columns'] = 'max';
571 $result['columns'] = $this->getInteger($columns, 80);
575 if ($root->hasAttribute('colors')) {
576 /* only allow boolean for compatibility with previous versions
577 'always' only allowed from command line */
578 if ($this->getBoolean($root->getAttribute('colors'), false)) {
579 $result['colors'] = PHPUnit_TextUI_ResultPrinter::COLOR_AUTO;
581 $result['colors'] = PHPUnit_TextUI_ResultPrinter::COLOR_NEVER;
588 if ($root->hasAttribute('stderr')) {
589 $result['stderr'] = $this->getBoolean(
590 (string) $root->getAttribute('stderr'),
595 if ($root->hasAttribute('backupGlobals')) {
596 $result['backupGlobals'] = $this->getBoolean(
597 (string) $root->getAttribute('backupGlobals'),
602 if ($root->hasAttribute('backupStaticAttributes')) {
603 $result['backupStaticAttributes'] = $this->getBoolean(
604 (string) $root->getAttribute('backupStaticAttributes'),
609 if ($root->getAttribute('bootstrap')) {
610 $result['bootstrap'] = $this->toAbsolutePath(
611 (string) $root->getAttribute('bootstrap')
615 if ($root->hasAttribute('convertErrorsToExceptions')) {
616 $result['convertErrorsToExceptions'] = $this->getBoolean(
617 (string) $root->getAttribute('convertErrorsToExceptions'),
622 if ($root->hasAttribute('convertNoticesToExceptions')) {
623 $result['convertNoticesToExceptions'] = $this->getBoolean(
624 (string) $root->getAttribute('convertNoticesToExceptions'),
629 if ($root->hasAttribute('convertWarningsToExceptions')) {
630 $result['convertWarningsToExceptions'] = $this->getBoolean(
631 (string) $root->getAttribute('convertWarningsToExceptions'),
636 if ($root->hasAttribute('forceCoversAnnotation')) {
637 $result['forceCoversAnnotation'] = $this->getBoolean(
638 (string) $root->getAttribute('forceCoversAnnotation'),
643 if ($root->hasAttribute('mapTestClassNameToCoveredClassName')) {
644 $result['mapTestClassNameToCoveredClassName'] = $this->getBoolean(
645 (string) $root->getAttribute('mapTestClassNameToCoveredClassName'),
650 if ($root->hasAttribute('processIsolation')) {
651 $result['processIsolation'] = $this->getBoolean(
652 (string) $root->getAttribute('processIsolation'),
657 if ($root->hasAttribute('stopOnError')) {
658 $result['stopOnError'] = $this->getBoolean(
659 (string) $root->getAttribute('stopOnError'),
664 if ($root->hasAttribute('stopOnFailure')) {
665 $result['stopOnFailure'] = $this->getBoolean(
666 (string) $root->getAttribute('stopOnFailure'),
671 if ($root->hasAttribute('stopOnIncomplete')) {
672 $result['stopOnIncomplete'] = $this->getBoolean(
673 (string) $root->getAttribute('stopOnIncomplete'),
678 if ($root->hasAttribute('stopOnRisky')) {
679 $result['stopOnRisky'] = $this->getBoolean(
680 (string) $root->getAttribute('stopOnRisky'),
685 if ($root->hasAttribute('stopOnSkipped')) {
686 $result['stopOnSkipped'] = $this->getBoolean(
687 (string) $root->getAttribute('stopOnSkipped'),
692 if ($root->hasAttribute('testSuiteLoaderClass')) {
693 $result['testSuiteLoaderClass'] = (string) $root->getAttribute(
694 'testSuiteLoaderClass'
698 if ($root->getAttribute('testSuiteLoaderFile')) {
699 $result['testSuiteLoaderFile'] = $this->toAbsolutePath(
700 (string) $root->getAttribute('testSuiteLoaderFile')
704 if ($root->hasAttribute('printerClass')) {
705 $result['printerClass'] = (string) $root->getAttribute(
710 if ($root->getAttribute('printerFile')) {
711 $result['printerFile'] = $this->toAbsolutePath(
712 (string) $root->getAttribute('printerFile')
716 if ($root->hasAttribute('timeoutForSmallTests')) {
717 $result['timeoutForSmallTests'] = $this->getInteger(
718 (string) $root->getAttribute('timeoutForSmallTests'),
723 if ($root->hasAttribute('timeoutForMediumTests')) {
724 $result['timeoutForMediumTests'] = $this->getInteger(
725 (string) $root->getAttribute('timeoutForMediumTests'),
730 if ($root->hasAttribute('timeoutForLargeTests')) {
731 $result['timeoutForLargeTests'] = $this->getInteger(
732 (string) $root->getAttribute('timeoutForLargeTests'),
737 if ($root->hasAttribute('beStrictAboutTestsThatDoNotTestAnything')) {
738 $result['reportUselessTests'] = $this->getBoolean(
739 (string) $root->getAttribute('beStrictAboutTestsThatDoNotTestAnything'),
744 if ($root->hasAttribute('checkForUnintentionallyCoveredCode')) {
745 $result['strictCoverage'] = $this->getBoolean(
746 (string) $root->getAttribute('checkForUnintentionallyCoveredCode'),
751 if ($root->hasAttribute('beStrictAboutOutputDuringTests')) {
752 $result['disallowTestOutput'] = $this->getBoolean(
753 (string) $root->getAttribute('beStrictAboutOutputDuringTests'),
758 if ($root->hasAttribute('beStrictAboutChangesToGlobalState')) {
759 $result['disallowChangesToGlobalState'] = $this->getBoolean(
760 (string) $root->getAttribute('beStrictAboutChangesToGlobalState'),
765 if ($root->hasAttribute('beStrictAboutTestSize')) {
766 $result['enforceTimeLimit'] = $this->getBoolean(
767 (string) $root->getAttribute('beStrictAboutTestSize'),
772 if ($root->hasAttribute('beStrictAboutTodoAnnotatedTests')) {
773 $result['disallowTodoAnnotatedTests'] = $this->getBoolean(
774 (string) $root->getAttribute('beStrictAboutTodoAnnotatedTests'),
779 if ($root->hasAttribute('strict')) {
780 $flag = $this->getBoolean(
781 (string) $root->getAttribute('strict'),
785 $result['reportUselessTests'] = $flag;
786 $result['strictCoverage'] = $flag;
787 $result['disallowTestOutput'] = $flag;
788 $result['enforceTimeLimit'] = $flag;
789 $result['disallowTodoAnnotatedTests'] = $flag;
790 $result['deprecatedStrictModeSetting'] = true;
793 if ($root->hasAttribute('verbose')) {
794 $result['verbose'] = $this->getBoolean(
795 (string) $root->getAttribute('verbose'),
804 * Returns the SeleniumTestCase browser configuration.
808 * @since Method available since Release 3.2.9
810 public function getSeleniumBrowserConfiguration()
814 foreach ($this->xpath->query('selenium/browser') as $config) {
815 $name = (string) $config->getAttribute('name');
816 $browser = (string) $config->getAttribute('browser');
818 if ($config->hasAttribute('host')) {
819 $host = (string) $config->getAttribute('host');
824 if ($config->hasAttribute('port')) {
825 $port = $this->getInteger(
826 (string) $config->getAttribute('port'),
833 if ($config->hasAttribute('timeout')) {
834 $timeout = $this->getInteger(
835 (string) $config->getAttribute('timeout'),
844 'browser' => $browser,
847 'timeout' => $timeout
855 * Returns the test suite configuration.
857 * @return PHPUnit_Framework_TestSuite
859 * @since Method available since Release 3.2.1
861 public function getTestSuiteConfiguration($testSuiteFilter = null)
863 $testSuiteNodes = $this->xpath->query('testsuites/testsuite');
865 if ($testSuiteNodes->length == 0) {
866 $testSuiteNodes = $this->xpath->query('testsuite');
869 if ($testSuiteNodes->length == 1) {
870 return $this->getTestSuite($testSuiteNodes->item(0), $testSuiteFilter);
873 if ($testSuiteNodes->length > 1) {
874 $suite = new PHPUnit_Framework_TestSuite;
876 foreach ($testSuiteNodes as $testSuiteNode) {
877 $suite->addTestSuite(
878 $this->getTestSuite($testSuiteNode, $testSuiteFilter)
887 * @param DOMElement $testSuiteNode
889 * @return PHPUnit_Framework_TestSuite
891 * @since Method available since Release 3.4.0
893 protected function getTestSuite(DOMElement $testSuiteNode, $testSuiteFilter = null)
895 if ($testSuiteNode->hasAttribute('name')) {
896 $suite = new PHPUnit_Framework_TestSuite(
897 (string) $testSuiteNode->getAttribute('name')
900 $suite = new PHPUnit_Framework_TestSuite;
905 foreach ($testSuiteNode->getElementsByTagName('exclude') as $excludeNode) {
906 $excludeFile = (string) $excludeNode->textContent;
908 $exclude[] = $this->toAbsolutePath($excludeFile);
912 $fileIteratorFacade = new File_Iterator_Facade;
914 foreach ($testSuiteNode->getElementsByTagName('directory') as $directoryNode) {
915 if ($testSuiteFilter && $directoryNode->parentNode->getAttribute('name') != $testSuiteFilter) {
919 $directory = (string) $directoryNode->textContent;
921 if (empty($directory)) {
925 if ($directoryNode->hasAttribute('phpVersion')) {
926 $phpVersion = (string) $directoryNode->getAttribute('phpVersion');
928 $phpVersion = PHP_VERSION;
931 if ($directoryNode->hasAttribute('phpVersionOperator')) {
932 $phpVersionOperator = (string) $directoryNode->getAttribute('phpVersionOperator');
934 $phpVersionOperator = '>=';
937 if (!version_compare(PHP_VERSION, $phpVersion, $phpVersionOperator)) {
941 if ($directoryNode->hasAttribute('prefix')) {
942 $prefix = (string) $directoryNode->getAttribute('prefix');
947 if ($directoryNode->hasAttribute('suffix')) {
948 $suffix = (string) $directoryNode->getAttribute('suffix');
950 $suffix = 'Test.php';
953 $files = $fileIteratorFacade->getFilesAsArray(
954 $this->toAbsolutePath($directory),
959 $suite->addTestFiles($files);
962 foreach ($testSuiteNode->getElementsByTagName('file') as $fileNode) {
963 if ($testSuiteFilter && $fileNode->parentNode->getAttribute('name') != $testSuiteFilter) {
967 $file = (string) $fileNode->textContent;
973 // Get the absolute path to the file
974 $file = $fileIteratorFacade->getFilesAsArray(
975 $this->toAbsolutePath($file)
978 if (!isset($file[0])) {
984 if ($fileNode->hasAttribute('phpVersion')) {
985 $phpVersion = (string) $fileNode->getAttribute('phpVersion');
987 $phpVersion = PHP_VERSION;
990 if ($fileNode->hasAttribute('phpVersionOperator')) {
991 $phpVersionOperator = (string) $fileNode->getAttribute('phpVersionOperator');
993 $phpVersionOperator = '>=';
996 if (!version_compare(PHP_VERSION, $phpVersion, $phpVersionOperator)) {
1000 $suite->addTestFile($file);
1007 * @param string $value
1008 * @param bool $default
1012 * @since Method available since Release 3.2.3
1014 protected function getBoolean($value, $default)
1016 if (strtolower($value) == 'false') {
1018 } elseif (strtolower($value) == 'true') {
1026 * @param string $value
1027 * @param bool $default
1031 * @since Method available since Release 3.6.0
1033 protected function getInteger($value, $default)
1035 if (is_numeric($value)) {
1036 return (int) $value;
1043 * @param string $query
1047 * @since Method available since Release 3.2.3
1049 protected function readFilterDirectories($query)
1051 $directories = array();
1053 foreach ($this->xpath->query($query) as $directory) {
1054 $directoryPath = (string) $directory->textContent;
1056 if (!$directoryPath) {
1060 if ($directory->hasAttribute('prefix')) {
1061 $prefix = (string) $directory->getAttribute('prefix');
1066 if ($directory->hasAttribute('suffix')) {
1067 $suffix = (string) $directory->getAttribute('suffix');
1072 if ($directory->hasAttribute('group')) {
1073 $group = (string) $directory->getAttribute('group');
1078 $directories[] = array(
1079 'path' => $this->toAbsolutePath($directoryPath),
1080 'prefix' => $prefix,
1081 'suffix' => $suffix,
1086 return $directories;
1090 * @param string $query
1094 * @since Method available since Release 3.2.3
1096 protected function readFilterFiles($query)
1100 foreach ($this->xpath->query($query) as $file) {
1101 $filePath = (string) $file->textContent;
1104 $files[] = $this->toAbsolutePath($filePath);
1112 * @param string $path
1113 * @param bool $useIncludePath
1117 * @since Method available since Release 3.5.0
1119 protected function toAbsolutePath($path, $useIncludePath = false)
1121 $path = trim($path);
1123 if ($path[0] === '/') {
1127 // Matches the following on Windows:
1128 // - \\NetworkComputer\Path
1135 if (defined('PHP_WINDOWS_VERSION_BUILD') &&
1136 ($path[0] === '\\' ||
1137 (strlen($path) >= 3 && preg_match('#^[A-Z]\:[/\\\]#i', substr($path, 0, 3))))) {
1142 if (strpos($path, '://') !== false) {
1146 $file = dirname($this->filename) . DIRECTORY_SEPARATOR . $path;
1148 if ($useIncludePath && !file_exists($file)) {
1149 $includePathFile = stream_resolve_include_path($path);
1151 if ($includePathFile) {
1152 $file = $includePathFile;