diff --git a/src/Util/Blacklist.php b/src/Util/Blacklist.php index 40f978812e6..d767d81bfbe 100644 --- a/src/Util/Blacklist.php +++ b/src/Util/Blacklist.php @@ -136,6 +136,15 @@ private function initialize() self::$directories[] = $directory; } + + // Hide process isolation workaround on Windows. + // @see PHPUnit_Util_PHP::factory() + // @see PHPUnit_Util_PHP_Windows::process() + if (DIRECTORY_SEPARATOR === '\\') { + // tempnam() prefix is limited to first 3 chars. + // @see http://php.net/manual/en/function.tempnam.php + self::$directories[] = sys_get_temp_dir() . '\\PHP'; + } } } } diff --git a/src/Util/XML.php b/src/Util/XML.php index e4ac534ddb1..97c68c66fde 100644 --- a/src/Util/XML.php +++ b/src/Util/XML.php @@ -135,36 +135,46 @@ public static function load($actual, $isHtml = false, $filename = '', $xinclude return $actual; } + // Required for XInclude on Windows. + if ($xinclude) { + $cwd = getcwd(); + chdir(dirname($filename)); + } + $document = new DOMDocument; $internal = libxml_use_internal_errors(true); $message = ''; $reporting = error_reporting(0); + if ('' !== $filename) { + // Necessary for xinclude + $document->documentURI = $filename; + } + if ($isHtml) { $loaded = $document->loadHTML($actual); } else { $loaded = $document->loadXML($actual); } - if ('' !== $filename) { - // Necessary for xinclude - $document->documentURI = $filename; - } - if (!$isHtml && $xinclude) { $document->xinclude(); } foreach (libxml_get_errors() as $error) { - $message .= $error->message; + $message .= "\n" . $error->message; } libxml_use_internal_errors($internal); error_reporting($reporting); - if ($loaded === false) { - if ($filename != '') { + if ($xinclude) { + chdir($cwd); + } + + if ($loaded === false || $message !== '') { + if ($filename !== '') { throw new PHPUnit_Framework_Exception( sprintf( 'Could not load "%s".%s', diff --git a/tests/Regression/578.phpt b/tests/Regression/578.phpt index dfbf855b395..4a4d3e07fbc 100644 --- a/tests/Regression/578.phpt +++ b/tests/Regression/578.phpt @@ -21,17 +21,17 @@ There were 3 errors: 1) Issue578Test::testNoticesDoublePrintStackTrace Invalid error type specified -%s/Issue578Test.php:%i +%sIssue578Test.php:%i 2) Issue578Test::testWarningsDoublePrintStackTrace Invalid error type specified -%s/Issue578Test.php:%i +%sIssue578Test.php:%i 3) Issue578Test::testUnexpectedExceptionsPrintsCorrectly Exception: Double printed exception -%s/Issue578Test.php:%i +%sIssue578Test.php:%i FAILURES! Tests: 3, Assertions: 0, Errors: 3. diff --git a/tests/Regression/GitHub/74.phpt b/tests/Regression/GitHub/74.phpt index 79b33a4a1f3..7005b41f4eb 100644 --- a/tests/Regression/GitHub/74.phpt +++ b/tests/Regression/GitHub/74.phpt @@ -22,7 +22,7 @@ There was 1 error: 1) Issue74Test::testCreateAndThrowNewExceptionInProcessIsolation NewException: Testing GH-74 -%s/tests/Regression/GitHub/74/Issue74Test.php:7 +%sIssue74Test.php:7 FAILURES! Tests: 1, Assertions: 0, Errors: 1. diff --git a/tests/TextUI/custom-printer-debug.phpt b/tests/TextUI/custom-printer-debug.phpt index a73d0ac9b5f..fcbd3a4705a 100644 --- a/tests/TextUI/custom-printer-debug.phpt +++ b/tests/TextUI/custom-printer-debug.phpt @@ -14,7 +14,7 @@ PHPUnit_TextUI_Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann. -Configuration read from %s/configuration.custom-printer.xml +Configuration read from %sconfiguration.custom-printer.xml Starting test 'BankAccountTest::testBalanceIsInitiallyZero'. diff --git a/tests/TextUI/custom-printer-verbose.phpt b/tests/TextUI/custom-printer-verbose.phpt index 4528e397d6f..fc5f9f481b8 100644 --- a/tests/TextUI/custom-printer-verbose.phpt +++ b/tests/TextUI/custom-printer-verbose.phpt @@ -14,7 +14,7 @@ PHPUnit_TextUI_Command::main(); --EXPECTF-- PHPUnit %s by Sebastian Bergmann. -Configuration read from %s/configuration.custom-printer.xml +Configuration read from %sconfiguration.custom-printer.xml I diff --git a/tests/TextUI/dataprovider-log-xml-isolation.phpt b/tests/TextUI/dataprovider-log-xml-isolation.phpt index bb8c55f1499..5154f422607 100644 --- a/tests/TextUI/dataprovider-log-xml-isolation.phpt +++ b/tests/TextUI/dataprovider-log-xml-isolation.phpt @@ -17,7 +17,7 @@ PHPUnit %s by Sebastian Bergmann. ..F. - + diff --git a/tests/TextUI/dataprovider-log-xml.phpt b/tests/TextUI/dataprovider-log-xml.phpt index fa7287c3bb0..9854e2f16a5 100644 --- a/tests/TextUI/dataprovider-log-xml.phpt +++ b/tests/TextUI/dataprovider-log-xml.phpt @@ -16,7 +16,7 @@ PHPUnit %s by Sebastian Bergmann. ..F. - +