wiki.techinc.nl/tests/phpunit/MediaWikiPHPUnitResultPrinter.php
Erik Bernhardson 96657099fc Report logs for each individual test failure
The initial implementation of reporting logs with test failures was
incorrect, it always reported the logs of the most recent test run.
Attach logs to the Test when a failure is reported and pull them
back out in the result printer.

Bug: T217489
Change-Id: I5aa55d6fa7a7ec03a2e71636b6b0366ea40605cb
2019-03-06 15:13:53 -08:00

14 lines
446 B
PHP

<?php
class MediaWikiPHPUnitResultPrinter extends PHPUnit_TextUI_ResultPrinter {
protected function printDefectTrace( PHPUnit_Framework_TestFailure $defect ) {
$test = $defect->failedTest();
if ( $test !== null && isset( $test->_formattedMediaWikiLogs ) ) {
$log = $test->_formattedMediaWikiLogs;
if ( $log ) {
$this->write( "=== Logs generated by test case\n{$log}\n===\n" );
}
}
parent::printDefectTrace( $defect );
}
}