Skip to content

Commit 9740a58

Browse files
committed
[BC BREAK] All relative paths in a configuration file are now resolved relative to that configuration file. When upgrading, you may need to update relative paths for the following configurations: * `testSuiteLoaderFile` * `printerFile` * `testsuites/file` * `testsuites/exclude`
1 parent fe892f1 commit 9740a58

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ PHPUnit 3.8.0
2323
* Implemented #877: Added new HTML5 tags to `PHPUnit_Util_XML::findNodes()`.
2424
* Added `--coverage-crap4j` switch to generate code coverage report in Crap4J XML format.
2525
* A test will now fail in strict mode when it uses the `@covers` annotation and code that is not expected to be covered is executed.
26+
* All relative paths in a configuration file are now resolved relative to that configuration file. When upgrading, you may need to update relative paths for the following configurations: `testSuiteLoaderFile`, `printerFile`, `testsuites/file`, `testsuites/exclude`.
2627
* Fixed #240: XML strings are escaped by removing invalid characters.
2728
* Fixed #261: `setUp()` and `setUpBeforeClass()` are run before filters are applied.
2829
* Fixed #541: Excluded groups are counted towards total number of tests being executed.

PHPUnit/Util/Configuration.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,8 @@ public function getPHPUnitConfiguration()
680680
}
681681

682682
if ($root->hasAttribute('testSuiteLoaderFile')) {
683-
$result['testSuiteLoaderFile'] = (string)$root->getAttribute(
684-
'testSuiteLoaderFile'
683+
$result['testSuiteLoaderFile'] = $this->toAbsolutePath(
684+
(string)$root->getAttribute('testSuiteLoaderFile')
685685
);
686686
}
687687

@@ -692,8 +692,8 @@ public function getPHPUnitConfiguration()
692692
}
693693

694694
if ($root->hasAttribute('printerFile')) {
695-
$result['printerFile'] = (string)$root->getAttribute(
696-
'printerFile'
695+
$result['printerFile'] = $this->toAbsolutePath(
696+
(string)$root->getAttribute('printerFile')
697697
);
698698
}
699699

@@ -827,7 +827,9 @@ protected function getTestSuite(DOMElement $testSuiteNode, $testSuiteFilter=null
827827
$exclude = array();
828828

829829
foreach ($testSuiteNode->getElementsByTagName('exclude') as $excludeNode) {
830-
$exclude[] = (string)$excludeNode->nodeValue;
830+
$exclude[] = $this->toAbsolutePath(
831+
(string)$excludeNode->nodeValue
832+
);
831833
}
832834

833835
$fileIteratorFacade = new File_Iterator_Facade;
@@ -892,7 +894,9 @@ protected function getTestSuite(DOMElement $testSuiteNode, $testSuiteFilter=null
892894
}
893895

894896
// Get the absolute path to the file
895-
$file = $fileIteratorFacade->getFilesAsArray($file);
897+
$file = $fileIteratorFacade->getFilesAsArray(
898+
$this->toAbsolutePath($file)
899+
);
896900

897901
if (!isset($file[0])) {
898902
continue;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit printerFile="Tests/_files/CustomPrinter.php" printerClass="CustomPrinter" />
2+
<phpunit printerFile="CustomPrinter.php" printerClass="CustomPrinter" />

0 commit comments

Comments
 (0)