From e834527db2aa2dac5596faa8dd832874b3b4baeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20N=C3=BCrnberger?= Date: Mon, 20 Jan 2025 09:39:10 +0100 Subject: [PATCH] Update JunitXmlLogger.php https://github.com/sebastianbergmann/phpunit/issues/6098 --- overrides/Logging/JUnit/JunitXmlLogger.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/overrides/Logging/JUnit/JunitXmlLogger.php b/overrides/Logging/JUnit/JunitXmlLogger.php index d90ab723..433bc05b 100644 --- a/overrides/Logging/JUnit/JunitXmlLogger.php +++ b/overrides/Logging/JUnit/JunitXmlLogger.php @@ -27,6 +27,7 @@ use PHPUnit\Event\Test\Finished; use PHPUnit\Event\Test\MarkedIncomplete; use PHPUnit\Event\Test\PreparationStarted; use PHPUnit\Event\Test\Prepared; +use PHPUnit\Event\Test\PrintedUnexpectedOutput; use PHPUnit\Event\Test\Skipped; use PHPUnit\Event\TestSuite\Started; use PHPUnit\Event\UnknownSubscriberTypeException; @@ -207,6 +208,18 @@ final class JunitXmlLogger $this->prepared = true; } + public function testPrintedUnexpectedOutput(PrintedUnexpectedOutput $event): void + { + assert($this->currentTestCase !== null); + + $systemOut = $this->document->createElement( + 'system-out', + Xml::prepareString($event->output()), + ); + + $this->currentTestCase->appendChild($systemOut); + } + /** * @throws InvalidArgumentException */ @@ -301,6 +314,7 @@ final class JunitXmlLogger new TestPreparationStartedSubscriber($this), new TestPreparationFailedSubscriber($this), new TestPreparedSubscriber($this), + new TestPrintedUnexpectedOutputSubscriber($this), new TestFinishedSubscriber($this), new TestErroredSubscriber($this), new TestFailedSubscriber($this),