Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294160

[PHPUnit 10+ only] Make dump() output in tests no longer use standard streams

$
0
0

Problem/Motivation

In #3432171: dump() no longer produces output in PHPUnit tests running under PHP 8.3 we fixed dump() no longer producing output in PHPUnit tests running in isolation under PHP 8.3, by changing writing to STDERR instead of STDOUT.

However, the fix is not sufficient as later #3452269: dump() calls in tests are producing a PHPUnit\Framework\Exception reported that dump() in kernel tests leads to test failures.

In this issue for PHPUnit 10+, see if we can adopt a different technique instead of using standard streams.

Proposed resolution

Take clues from HtmlOutputLogger and #3453341: Bootstrap HtmlOutputLogger from phpunit.xml, and introduce a PHPUnit extension that captures the output of dump() during the tests, and prints it cumulatively at the end of the testrunner execution. In this, enhance the experience to also add information about where each dump() call happened.

The bigger hurdle here are processes run in isolation (many unit ones, and all kernel/functional/functionaljavascript ones): there's no easy way to return information from the 'isolated' test back to its parent testrunner. However, using an environment variable and a staging file likewise HtmlOutputLogger, we can achieve that.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 294160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>