diff --git a/ChangeLog-7.2.md b/ChangeLog-7.2.md index 27128083f32..53b3a13b844 100644 --- a/ChangeLog-7.2.md +++ b/ChangeLog-7.2.md @@ -2,6 +2,12 @@ All notable changes of the PHPUnit 7.2 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## [7.2.4] - 2018-MM-DD + +### Fixed + +* Fixed [#3160](https://github.com/sebastianbergmann/phpunit/issues/3160): TeamCity logfile writer broken on Windows + ## [7.2.3] - 2018-06-03 ### Fixed @@ -40,6 +46,7 @@ All notable changes of the PHPUnit 7.2 release series are documented in this fil * Fixed [#3069](https://github.com/sebastianbergmann/phpunit/issues/3069): Method `ResultPrinter::printWaitPrompt()` seems to be unused +[7.2.4]: https://github.com/sebastianbergmann/phpunit/compare/7.2.3...7.2.4 [7.2.3]: https://github.com/sebastianbergmann/phpunit/compare/7.2.2...7.2.3 [7.2.2]: https://github.com/sebastianbergmann/phpunit/compare/7.2.1...7.2.2 [7.2.1]: https://github.com/sebastianbergmann/phpunit/compare/7.2.0...7.2.1 diff --git a/src/Framework/Assert.php b/src/Framework/Assert.php index f4ca2bb89bf..ebf45aa5069 100644 --- a/src/Framework/Assert.php +++ b/src/Framework/Assert.php @@ -2143,7 +2143,7 @@ public static function assertEqualXMLStructure(DOMElement $expectedElement, DOME \sprintf( '%s%sNumber of attributes on node "%s" does not match', $message, - !empty($message) ? PHP_EOL : '', + !empty($message) ? "\n" : '', $expectedElement->tagName ) ); @@ -2159,7 +2159,7 @@ public static function assertEqualXMLStructure(DOMElement $expectedElement, DOME \sprintf( '%s%sCould not find attribute "%s" on node "%s"', $message, - !empty($message) ? PHP_EOL : '', + !empty($message) ? "\n" : '', $expectedAttribute->name, $expectedElement->tagName ) @@ -2177,7 +2177,7 @@ public static function assertEqualXMLStructure(DOMElement $expectedElement, DOME \sprintf( '%s%sNumber of child nodes of "%s" differs', $message, - !empty($message) ? PHP_EOL : '', + !empty($message) ? "\n" : '', $expectedElement->tagName ) ); diff --git a/src/Framework/Constraint/Constraint.php b/src/Framework/Constraint/Constraint.php index 8ce03e9b320..b02c9f6dcdb 100644 --- a/src/Framework/Constraint/Constraint.php +++ b/src/Framework/Constraint/Constraint.php @@ -105,11 +105,11 @@ protected function fail($other, $description, ComparisonFailure $comparisonFailu $additionalFailureDescription = $this->additionalFailureDescription($other); if ($additionalFailureDescription) { - $failureDescription .= PHP_EOL . $additionalFailureDescription; + $failureDescription .= "\n" . $additionalFailureDescription; } if (!empty($description)) { - $failureDescription = $description . PHP_EOL . $failureDescription; + $failureDescription = $description . "\n" . $failureDescription; } throw new ExpectationFailedException( diff --git a/src/Framework/Constraint/Exception.php b/src/Framework/Constraint/Exception.php index 327e0baf830..7e0c021fb99 100644 --- a/src/Framework/Constraint/Exception.php +++ b/src/Framework/Constraint/Exception.php @@ -63,7 +63,7 @@ protected function failureDescription($other): string if ($other instanceof Throwable) { $message = '. Message was: "' . $other->getMessage() . '" at' - . PHP_EOL . Filter::getFilteredStacktrace($other); + . "\n" . Filter::getFilteredStacktrace($other); } return \sprintf( diff --git a/src/Framework/Constraint/IsEqual.php b/src/Framework/Constraint/IsEqual.php index b9bba72b75f..0ad1a52b629 100644 --- a/src/Framework/Constraint/IsEqual.php +++ b/src/Framework/Constraint/IsEqual.php @@ -108,7 +108,7 @@ public function evaluate($other, $description = '', $returnResult = false) } throw new ExpectationFailedException( - \trim($description . PHP_EOL . $f->getMessage()), + \trim($description . "\n" . $f->getMessage()), $f ); } @@ -126,7 +126,7 @@ public function toString(): string $delta = ''; if (\is_string($this->value)) { - if (\strpos($this->value, PHP_EOL) !== false) { + if (\strpos($this->value, "\n") !== false) { return 'is equal to '; } diff --git a/src/Framework/Constraint/StringMatchesFormatDescription.php b/src/Framework/Constraint/StringMatchesFormatDescription.php index 72dc69718d9..c310da97fe8 100644 --- a/src/Framework/Constraint/StringMatchesFormatDescription.php +++ b/src/Framework/Constraint/StringMatchesFormatDescription.php @@ -55,8 +55,8 @@ protected function failureDescription($other): string protected function additionalFailureDescription($other): string { - $from = \explode(PHP_EOL, $this->string); - $to = \explode(PHP_EOL, $this->convertNewlines($other)); + $from = \explode("\n", $this->string); + $to = \explode("\n", $this->convertNewlines($other)); foreach ($from as $index => $line) { if (isset($to[$index]) && $line !== $to[$index]) { @@ -68,8 +68,8 @@ protected function additionalFailureDescription($other): string } } - $this->string = \implode(PHP_EOL, $from); - $other = \implode(PHP_EOL, $to); + $this->string = \implode("\n", $from); + $other = \implode("\n", $to); $differ = new Differ("--- Expected\n+++ Actual\n"); @@ -115,6 +115,6 @@ private function createPatternFromFormat(string $string): string private function convertNewlines($text): string { - return \preg_replace('/\r\n/', PHP_EOL, $text); + return \preg_replace('/\r\n/', "\n", $text); } } diff --git a/src/Framework/Constraint/TraversableContains.php b/src/Framework/Constraint/TraversableContains.php index efa05bda5f0..8196f33fafe 100644 --- a/src/Framework/Constraint/TraversableContains.php +++ b/src/Framework/Constraint/TraversableContains.php @@ -53,7 +53,7 @@ public function __construct($value, bool $checkForObjectIdentity = true, bool $c */ public function toString(): string { - if (\is_string($this->value) && \strpos($this->value, PHP_EOL) !== false) { + if (\is_string($this->value) && \strpos($this->value, "\n") !== false) { return 'contains "' . $this->value . '"'; } diff --git a/src/Framework/Exception.php b/src/Framework/Exception.php index 1ab80d514da..2ea2a1bc074 100644 --- a/src/Framework/Exception.php +++ b/src/Framework/Exception.php @@ -57,7 +57,7 @@ public function __toString(): string $string = TestFailure::exceptionToString($this); if ($trace = Filter::getFilteredStacktrace($this)) { - $string .= PHP_EOL . $trace; + $string .= "\n" . $trace; } return $string; diff --git a/src/Framework/ExceptionWrapper.php b/src/Framework/ExceptionWrapper.php index b1bcd2014c8..30a6a4e6d97 100644 --- a/src/Framework/ExceptionWrapper.php +++ b/src/Framework/ExceptionWrapper.php @@ -52,7 +52,7 @@ public function __toString(): string $string = TestFailure::exceptionToString($this); if ($trace = Filter::getFilteredStacktrace($this)) { - $string .= PHP_EOL . $trace; + $string .= "\n" . $trace; } if ($this->previous) { diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index 54fcfc43a25..2184b9cc94e 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -852,7 +852,7 @@ public function runBare(): void if (!empty($this->warnings)) { throw new Warning( \implode( - PHP_EOL, + "\n", \array_unique($this->warnings) ) ); diff --git a/src/Framework/TestFailure.php b/src/Framework/TestFailure.php index d0ae2f497d8..1dda756bbbf 100644 --- a/src/Framework/TestFailure.php +++ b/src/Framework/TestFailure.php @@ -48,21 +48,21 @@ public static function exceptionToString(Throwable $e): string } if (!empty($buffer)) { - $buffer = \trim($buffer) . PHP_EOL; + $buffer = \trim($buffer) . "\n"; } return $buffer; } if ($e instanceof Error) { - return $e->getMessage() . PHP_EOL; + return $e->getMessage() . "\n"; } if ($e instanceof ExceptionWrapper) { - return $e->getClassName() . ': ' . $e->getMessage() . PHP_EOL; + return $e->getClassName() . ': ' . $e->getMessage() . "\n"; } - return \get_class($e) . ': ' . $e->getMessage() . PHP_EOL; + return \get_class($e) . ': ' . $e->getMessage() . "\n"; } /** diff --git a/src/Framework/TestSuite.php b/src/Framework/TestSuite.php index 78eb03ba877..7192ab98b72 100644 --- a/src/Framework/TestSuite.php +++ b/src/Framework/TestSuite.php @@ -164,7 +164,7 @@ public static function createTest(ReflectionClass $theClass, $name): Test $_message = $e->getMessage(); if (!empty($_message)) { - $message .= PHP_EOL . $_message; + $message .= "\n" . $_message; } $data = self::incompleteTest($className, $name, $message); @@ -178,7 +178,7 @@ public static function createTest(ReflectionClass $theClass, $name): Test $_message = $e->getMessage(); if (!empty($_message)) { - $message .= PHP_EOL . $_message; + $message .= "\n" . $_message; } $data = self::skipTest($className, $name, $message); @@ -198,7 +198,7 @@ public static function createTest(ReflectionClass $theClass, $name): Test $_message = $t->getMessage(); if (!empty($_message)) { - $message .= PHP_EOL . $_message; + $message .= "\n" . $_message; } $data = self::warning($message); diff --git a/src/Runner/PhptTestCase.php b/src/Runner/PhptTestCase.php index 7bb6cf0901f..f268ade40c4 100644 --- a/src/Runner/PhptTestCase.php +++ b/src/Runner/PhptTestCase.php @@ -211,7 +211,7 @@ public function toString(): string private function parseIniSection($content, $ini = []): array { if (\is_string($content)) { - $content = \explode(PHP_EOL, \trim($content)); + $content = \explode("\n", \trim($content)); } foreach ($content as $setting) { @@ -243,7 +243,7 @@ private function parseEnvSection(string $content): array { $env = []; - foreach (\explode(PHP_EOL, \trim($content)) as $e) { + foreach (\explode("\n", \trim($content)) as $e) { $e = \explode('=', \trim($e), 2); if (!empty($e[0]) && isset($e[1])) { @@ -265,11 +265,11 @@ private function assertPhptExpectation(array $sections, string $output): void 'EXPECTREGEX' => 'assertRegExp', ]; - $actual = \preg_replace('/\r\n/', PHP_EOL, \trim($output)); + $actual = \preg_replace('/\r\n/', "\n", \trim($output)); foreach ($assertions as $sectionName => $sectionAssertion) { if (isset($sections[$sectionName])) { - $sectionContent = \preg_replace('/\r\n/', PHP_EOL, \trim($sections[$sectionName])); + $sectionContent = \preg_replace('/\r\n/', "\n", \trim($sections[$sectionName])); $assertion = $sectionAssertion; $expected = $sectionName === 'EXPECTREGEX' ? "/{$sectionContent}/" : $sectionContent; diff --git a/src/TextUI/ResultPrinter.php b/src/TextUI/ResultPrinter.php index 02178081875..7fe0cb18c27 100644 --- a/src/TextUI/ResultPrinter.php +++ b/src/TextUI/ResultPrinter.php @@ -438,7 +438,7 @@ protected function printFooter(TestResult $result): void $color = 'fg-black, bg-yellow'; if ($this->verbose || !$result->allHarmless()) { - $this->write(PHP_EOL); + $this->write("\n"); } $this->writeWithColor( @@ -446,7 +446,7 @@ protected function printFooter(TestResult $result): void 'OK, but incomplete, skipped, or risky tests!' ); } else { - $this->write(PHP_EOL); + $this->write("\n"); if ($result->errorCount()) { $color = 'fg-white, bg-red'; @@ -518,7 +518,7 @@ protected function writeProgress(string $progress): void protected function writeNewLine(): void { $this->column = 0; - $this->write(PHP_EOL); + $this->write("\n"); } /** @@ -532,7 +532,7 @@ protected function formatWithColor(string $color, string $buffer): string } $codes = \array_map('\trim', \explode(',', $color)); - $lines = \explode(PHP_EOL, $buffer); + $lines = \explode("\n", $buffer); $padding = \max(\array_map('\strlen', $lines)); $styles = []; @@ -548,7 +548,7 @@ protected function formatWithColor(string $color, string $buffer): string $styledLines[] = $style . \str_pad($line, $padding) . "\x1b[0m"; } - return \implode(PHP_EOL, $styledLines); + return \implode("\n", $styledLines); } /** @@ -559,7 +559,7 @@ protected function writeWithColor(string $color, string $buffer, bool $lf = true $this->write($this->formatWithColor($color, $buffer)); if ($lf) { - $this->write(PHP_EOL); + $this->write("\n"); } } diff --git a/src/TextUI/TestRunner.php b/src/TextUI/TestRunner.php index ec9efd14624..6b6f55e35d9 100644 --- a/src/TextUI/TestRunner.php +++ b/src/TextUI/TestRunner.php @@ -284,7 +284,7 @@ public function doRun(Test $suite, array $arguments = [], bool $exit = true): Te } $this->printer->write( - Version::getVersionString() . PHP_EOL + Version::getVersionString() . "\n" ); self::$versionStringPrinted = true; @@ -534,7 +534,7 @@ public function doRun(Test $suite, array $arguments = [], bool $exit = true): Te } } - $this->printer->write(PHP_EOL); + $this->printer->write("\n"); if (isset($codeCoverage)) { $result->setCodeCoverage($codeCoverage); @@ -591,7 +591,7 @@ public function doRun(Test $suite, array $arguments = [], bool $exit = true): Te unset($writer); } catch (CodeCoverageException $e) { $this->printer->write( - " failed\n" . $e->getMessage() . PHP_EOL + " failed\n" . $e->getMessage() . "\n" ); } } @@ -609,7 +609,7 @@ public function doRun(Test $suite, array $arguments = [], bool $exit = true): Te unset($writer); } catch (CodeCoverageException $e) { $this->printer->write( - " failed\n" . $e->getMessage() . PHP_EOL + " failed\n" . $e->getMessage() . "\n" ); } } @@ -635,7 +635,7 @@ public function doRun(Test $suite, array $arguments = [], bool $exit = true): Te unset($writer); } catch (CodeCoverageException $e) { $this->printer->write( - " failed\n" . $e->getMessage() . PHP_EOL + " failed\n" . $e->getMessage() . "\n" ); } } @@ -653,7 +653,7 @@ public function doRun(Test $suite, array $arguments = [], bool $exit = true): Te unset($writer); } catch (CodeCoverageException $e) { $this->printer->write( - " failed\n" . $e->getMessage() . PHP_EOL + " failed\n" . $e->getMessage() . "\n" ); } } @@ -692,7 +692,7 @@ public function doRun(Test $suite, array $arguments = [], bool $exit = true): Te unset($writer); } catch (CodeCoverageException $e) { $this->printer->write( - " failed\n" . $e->getMessage() . PHP_EOL + " failed\n" . $e->getMessage() . "\n" ); } } @@ -1198,7 +1198,7 @@ private function processSuiteFilters(TestSuite $suite, array $arguments): void private function writeMessage(string $type, string $message): void { if (!$this->messagePrinted) { - $this->write(PHP_EOL); + $this->write("\n"); } $this->write( diff --git a/src/Util/FileLoader.php b/src/Util/FileLoader.php index 95f8cbef51f..e1198d2b071 100644 --- a/src/Util/FileLoader.php +++ b/src/Util/FileLoader.php @@ -38,7 +38,7 @@ public static function checkAndLoad(string $filename): string if (!$includePathFilename || !$isReadable || $includePathFilename === $localFile) { throw new Exception( - \sprintf('Cannot open file "%s".' . PHP_EOL, $filename) + \sprintf('Cannot open file "%s".' . "\n", $filename) ); } diff --git a/src/Util/GlobalState.php b/src/Util/GlobalState.php index 93d0c5c5dc2..6fff1802b5e 100644 --- a/src/Util/GlobalState.php +++ b/src/Util/GlobalState.php @@ -76,7 +76,7 @@ public static function getIniSettingsAsString(): string foreach ($iniSettings as $key => $value) { $result .= \sprintf( - '@ini_set(%s, %s);' . PHP_EOL, + '@ini_set(%s, %s);' . "\n", self::exportVariable($key), self::exportVariable($value) ); @@ -93,7 +93,7 @@ public static function getConstantsAsString(): string if (isset($constants['user'])) { foreach ($constants['user'] as $name => $value) { $result .= \sprintf( - 'if (!defined(\'%s\')) define(\'%s\', %s);' . PHP_EOL, + 'if (!defined(\'%s\')) define(\'%s\', %s);' . "\n", $name, $name, self::exportVariable($value) @@ -116,7 +116,7 @@ public static function getGlobalsAsString(): string } $result .= \sprintf( - '$GLOBALS[\'%s\'][\'%s\'] = %s;' . PHP_EOL, + '$GLOBALS[\'%s\'][\'%s\'] = %s;' . "\n", $superGlobalArray, $key, self::exportVariable($GLOBALS[$superGlobalArray][$key]) @@ -131,7 +131,7 @@ public static function getGlobalsAsString(): string foreach (\array_keys($GLOBALS) as $key) { if (!$GLOBALS[$key] instanceof Closure && !\in_array($key, $blacklist, true)) { $result .= \sprintf( - '$GLOBALS[\'%s\'] = %s;' . PHP_EOL, + '$GLOBALS[\'%s\'] = %s;' . "\n", $key, self::exportVariable($GLOBALS[$key]) ); diff --git a/src/Util/Log/JUnit.php b/src/Util/Log/JUnit.php index 842a1f5b396..2793ab35310 100644 --- a/src/Util/Log/JUnit.php +++ b/src/Util/Log/JUnit.php @@ -388,12 +388,12 @@ private function doAddFault(Test $test, \Throwable $t, float $time, $type): void } if ($test instanceof SelfDescribing) { - $buffer = $test->toString() . PHP_EOL; + $buffer = $test->toString() . "\n"; } else { $buffer = ''; } - $buffer .= TestFailure::exceptionToString($t) . PHP_EOL . + $buffer .= TestFailure::exceptionToString($t) . "\n" . Filter::getFilteredStacktrace($t); $fault = $this->document->createElement( diff --git a/src/Util/Log/TeamCity.php b/src/Util/Log/TeamCity.php index f1411d60de8..f663da8236d 100644 --- a/src/Util/Log/TeamCity.php +++ b/src/Util/Log/TeamCity.php @@ -338,14 +338,14 @@ private static function getDetails(\Throwable $t): string while ($previous) { $stackTrace .= "\nCaused by\n" . - TestFailure::exceptionToString($previous) . PHP_EOL . + TestFailure::exceptionToString($previous) . "\n" . Filter::getFilteredStacktrace($previous); $previous = $previous instanceof ExceptionWrapper ? $previous->getPreviousWrapped() : $previous->getPrevious(); } - return ' ' . \str_replace(PHP_EOL, "\n ", $stackTrace); + return ' ' . \str_replace("\n", "\n ", $stackTrace); } /** @@ -374,7 +374,7 @@ private static function getPrimitiveValueAsString($value): ?string private static function escapeValue(string $text): string { return \str_replace( - ['|', "'", PHP_EOL, "\r", ']', '['], + ['|', "'", "\n", "\r", ']', '['], ['||', "|'", '|n', '|r', '|]', '|['], $text ); diff --git a/src/Util/Test.php b/src/Util/Test.php index 7cccffdfc32..59740c2b968 100644 --- a/src/Util/Test.php +++ b/src/Util/Test.php @@ -160,7 +160,7 @@ public static function getRequirements(string $className, string $methodName): a $reflector = new ReflectionClass($className); $docComment = $reflector->getDocComment(); $reflector = new ReflectionMethod($className, $methodName); - $docComment .= PHP_EOL . $reflector->getDocComment(); + $docComment .= "\n" . $reflector->getDocComment(); $requires = []; if ($count = \preg_match_all(self::REGEX_REQUIRES_OS, $docComment, $matches)) { @@ -445,7 +445,7 @@ public static function getDataFromTestWithAnnotation(string $docComment): ?array $annotationContent = \substr($docComment, $offset); $data = []; - foreach (\explode(PHP_EOL, $annotationContent) as $candidateRow) { + foreach (\explode("\n", $annotationContent) as $candidateRow) { $candidateRow = \trim($candidateRow); if ($candidateRow[0] !== '[') { @@ -876,10 +876,10 @@ private static function getDataFromDataProviderAnnotation(string $docComment, st private static function cleanUpMultiLineAnnotation(string $docComment): string { //removing initial ' * ' for docComment - $docComment = \str_replace("\r\n", PHP_EOL, $docComment); - $docComment = \preg_replace('/' . '\n' . '\s*' . '\*' . '\s?' . '/', PHP_EOL, $docComment); + $docComment = \str_replace("\r\n", "\n", $docComment); + $docComment = \preg_replace('/' . '\n' . '\s*' . '\*' . '\s?' . '/', "\n", $docComment); $docComment = \substr($docComment, 0, -1); - $docComment = \rtrim($docComment, PHP_EOL); + $docComment = \rtrim($docComment, "\n"); return $docComment; } diff --git a/src/Util/TestDox/CliTestDoxPrinter.php b/src/Util/TestDox/CliTestDoxPrinter.php index 4f23e70b3ad..9932605bba5 100644 --- a/src/Util/TestDox/CliTestDoxPrinter.php +++ b/src/Util/TestDox/CliTestDoxPrinter.php @@ -194,7 +194,7 @@ public function printResult(TestResult $result): void protected function printHeader(): void { - $this->write(PHP_EOL . Timer::resourceUsage() . "\n\n"); + $this->write("\n" . Timer::resourceUsage() . "\n\n"); } private function printNonSuccessfulTestsSummary(int $numberOfExecutedTests): void diff --git a/src/Util/TestDox/TestResult.php b/src/Util/TestDox/TestResult.php index 10fc8eb51d5..6d8ae2fcf44 100644 --- a/src/Util/TestDox/TestResult.php +++ b/src/Util/TestDox/TestResult.php @@ -83,7 +83,7 @@ public function toString(?self $previousTestResult, $verbose = false): string { return \sprintf( "%s%s %s %s%s\n%s", - $previousTestResult && $previousTestResult->additionalInformationPrintable($verbose) ? PHP_EOL : '', + $previousTestResult && $previousTestResult->additionalInformationPrintable($verbose) ? "\n" : '', $this->getClassNameHeader($previousTestResult ? $previousTestResult->testClass : null), $this->symbol, $this->testMethod, @@ -98,7 +98,7 @@ private function getClassNameHeader(?string $previousTestClass): string if ($this->testClass !== $previousTestClass) { if (null !== $previousTestClass) { - $className = PHP_EOL; + $className = "\n"; } $className .= \sprintf("%s\n", $this->testClass); @@ -129,12 +129,12 @@ private function getFormattedAdditionalInformation($verbose): string return \sprintf( " │\n%s\n", \implode( - PHP_EOL, + "\n", \array_map( function (string $text) { return \sprintf(' │ %s', $text); }, - \explode(PHP_EOL, $this->additionalInformation) + \explode("\n", $this->additionalInformation) ) ) ); diff --git a/src/Util/TestDox/TextResultPrinter.php b/src/Util/TestDox/TextResultPrinter.php index 50cf8a1788c..a9cd66c4764 100644 --- a/src/Util/TestDox/TextResultPrinter.php +++ b/src/Util/TestDox/TextResultPrinter.php @@ -20,7 +20,7 @@ class TextResultPrinter extends ResultPrinter */ protected function startClass(string $name): void { - $this->write($this->currentTestClassPrettified . PHP_EOL); + $this->write($this->currentTestClassPrettified . "\n"); } /** @@ -36,7 +36,7 @@ protected function onTest($name, bool $success = true): void $this->write(' [ ] '); } - $this->write($name . PHP_EOL); + $this->write($name . "\n"); } /** @@ -44,6 +44,6 @@ protected function onTest($name, bool $success = true): void */ protected function endClass(string $name): void { - $this->write(PHP_EOL); + $this->write("\n"); } } diff --git a/src/Util/Xml.php b/src/Util/Xml.php index e3054c62ee3..09e751b0b28 100644 --- a/src/Util/Xml.php +++ b/src/Util/Xml.php @@ -84,7 +84,7 @@ public static function load($actual, bool $isHtml = false, string $filename = '' } foreach (\libxml_get_errors() as $error) { - $message .= PHP_EOL . $error->message; + $message .= "\n" . $error->message; } \libxml_use_internal_errors($internal); @@ -100,7 +100,7 @@ public static function load($actual, bool $isHtml = false, string $filename = '' \sprintf( 'Could not load "%s".%s', $filename, - $message !== '' ? PHP_EOL . $message : '' + $message !== '' ? "\n" . $message : '' ) ); } diff --git a/tests/Framework/Constraint/IsEqualTest.php b/tests/Framework/Constraint/IsEqualTest.php index bd886829d22..b208bd82b8c 100644 --- a/tests/Framework/Constraint/IsEqualTest.php +++ b/tests/Framework/Constraint/IsEqualTest.php @@ -321,6 +321,6 @@ public function isEqualProvider() */ private function trimnl($string) { - return \preg_replace('/[ ]*\n/', PHP_EOL, $string); + return \preg_replace('/[ ]*\n/', "\n", $string); } } diff --git a/tests/Framework/Constraint/IsTypeTest.php b/tests/Framework/Constraint/IsTypeTest.php index 7949b77801b..8504da0755f 100644 --- a/tests/Framework/Constraint/IsTypeTest.php +++ b/tests/Framework/Constraint/IsTypeTest.php @@ -109,6 +109,6 @@ public function testIterableTypeIsSupported(): void */ private function trimnl($string) { - return \preg_replace('/[ ]*\n/', PHP_EOL, $string); + return \preg_replace('/[ ]*\n/', "\n", $string); } } diff --git a/tests/Framework/ConstraintTest.php b/tests/Framework/ConstraintTest.php index a39a767fbb4..b3b88d37c2f 100644 --- a/tests/Framework/ConstraintTest.php +++ b/tests/Framework/ConstraintTest.php @@ -1488,6 +1488,6 @@ public function testConstraintException(): void */ private function trimnl($string) { - return \preg_replace('/[ ]*\n/', PHP_EOL, $string); + return \preg_replace('/[ ]*\n/', "\n", $string); } } diff --git a/tests/Framework/MockObject/MockObjectTest.php b/tests/Framework/MockObject/MockObjectTest.php index d5f9a02b042..a5a15c93083 100644 --- a/tests/Framework/MockObject/MockObjectTest.php +++ b/tests/Framework/MockObject/MockObjectTest.php @@ -663,8 +663,8 @@ public function testVerificationOfMethodNameFailsWithoutParameters(): void $this->fail('Expected exception'); } catch (ExpectationFailedException $e) { $this->assertSame( - 'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . PHP_EOL . - 'Method was expected to be called 1 times, actually called 0 times.' . PHP_EOL, + 'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . "\n" . + 'Method was expected to be called 1 times, actually called 0 times.' . "\n", $e->getMessage() ); } @@ -688,8 +688,8 @@ public function testVerificationOfMethodNameFailsWithParameters(): void $this->fail('Expected exception'); } catch (ExpectationFailedException $e) { $this->assertSame( - 'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . PHP_EOL . - 'Method was expected to be called 1 times, actually called 0 times.' . PHP_EOL, + 'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . "\n" . + 'Method was expected to be called 1 times, actually called 0 times.' . "\n", $e->getMessage() ); } @@ -711,8 +711,8 @@ public function testVerificationOfMethodNameFailsWithWrongParameters(): void $mock->right(['second']); } catch (ExpectationFailedException $e) { $this->assertSame( - 'Expectation failed for method name is equal to "right" when invoked 1 time(s)' . PHP_EOL . - 'Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.' . PHP_EOL . + 'Expectation failed for method name is equal to "right" when invoked 1 time(s)' . "\n" . + 'Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.' . "\n" . 'Failed asserting that two arrays are equal.', $e->getMessage() ); @@ -725,17 +725,17 @@ public function testVerificationOfMethodNameFailsWithWrongParameters(): void // $this->fail('Expected exception'); } catch (ExpectationFailedException $e) { $this->assertSame( - 'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . PHP_EOL . - 'Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.' . PHP_EOL . - 'Failed asserting that two arrays are equal.' . PHP_EOL . - '--- Expected' . PHP_EOL . - '+++ Actual' . PHP_EOL . - '@@ @@' . PHP_EOL . - ' Array (' . PHP_EOL . - '- 0 => \'first\'' . PHP_EOL . - '- 1 => \'second\'' . PHP_EOL . - '+ 0 => \'second\'' . PHP_EOL . - ' )' . PHP_EOL, + 'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . "\n" . + 'Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.' . "\n" . + 'Failed asserting that two arrays are equal.' . "\n" . + '--- Expected' . "\n" . + '+++ Actual' . "\n" . + '@@ @@' . "\n" . + ' Array (' . "\n" . + '- 0 => \'first\'' . "\n" . + '- 1 => \'second\'' . "\n" . + '+ 0 => \'second\'' . "\n" . + ' )' . "\n", $e->getMessage() ); } @@ -804,8 +804,8 @@ public function testWithAnythingInsteadOfWithAnyParameters(): void $this->fail('Expected exception'); } catch (ExpectationFailedException $e) { $this->assertSame( - 'Expectation failed for method name is equal to "right" when invoked 1 time(s)' . PHP_EOL . - 'Parameter count for invocation SomeClass::right() is too low.' . PHP_EOL . + 'Expectation failed for method name is equal to "right" when invoked 1 time(s)' . "\n" . + 'Parameter count for invocation SomeClass::right() is too low.' . "\n" . 'To allow 0 or more parameters with any value, omit ->with() or use ->withAnyParameters() instead.', $e->getMessage() ); diff --git a/tests/_files/TemplateMethodsTest.php b/tests/_files/TemplateMethodsTest.php index 7a0103a1663..c2f68b4c5e1 100644 --- a/tests/_files/TemplateMethodsTest.php +++ b/tests/_files/TemplateMethodsTest.php @@ -13,49 +13,49 @@ class TemplateMethodsTest extends TestCase { public static function setUpBeforeClass(): void { - print __METHOD__ . PHP_EOL; + print __METHOD__ . "\n"; } public static function tearDownAfterClass(): void { - print __METHOD__ . PHP_EOL; + print __METHOD__ . "\n"; } protected function setUp(): void { - print __METHOD__ . PHP_EOL; + print __METHOD__ . "\n"; } protected function tearDown(): void { - print __METHOD__ . PHP_EOL; + print __METHOD__ . "\n"; } public function testOne(): void { - print __METHOD__ . PHP_EOL; + print __METHOD__ . "\n"; $this->assertTrue(true); } public function testTwo(): void { - print __METHOD__ . PHP_EOL; + print __METHOD__ . "\n"; $this->assertTrue(false); } protected function assertPreConditions(): void { - print __METHOD__ . PHP_EOL; + print __METHOD__ . "\n"; } protected function assertPostConditions(): void { - print __METHOD__ . PHP_EOL; + print __METHOD__ . "\n"; } protected function onNotSuccessfulTest(Throwable $t): void { - print __METHOD__ . PHP_EOL; + print __METHOD__ . "\n"; throw $t; }