The previous output meant that when reviewing the build output, it was quite hard to quickly find what the problem was and in which test because the start of the result (which mentions the test suite) and the expected/actual diff, were often separated by dozens or hundreds of lines of "helpful" debug logs. These are now moved to the after the expected/actual/stacktrace portion so that "Name of test" and "expected/actual" remain together. Before > 1) ResourceLoaderFilePathTest::testGetters > === Logs generated by test case > … > … > … > … > … > … > … > === > Failed asserting that two strings are identical. > --- Expected > +++ Actual > @@ @@ > -'dummy/pat' > +'bla' > /var/mediawiki/tests/phpunit/resourceloader/ResourceLoaderFilePathTest.php:22 After > 1) ResourceLoaderFilePathTest::testGetters > Failed asserting that two strings are identical. > --- Expected > +++ Actual > @@ @@ > -'dummy/pat' > +'bla' > /var/mediawiki/tests/phpunit/resourceloader/ResourceLoaderFilePathTest.php:22 > === Logs generated by test case > … > … > … > … > … > … > … > === Change-Id: I31f1a4b730a0dd8597a059034b4e6abdc5f48552
17 lines
490 B
PHP
17 lines
490 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestFailure;
|
|
use PHPUnit\TextUI\ResultPrinter;
|
|
|
|
class MediaWikiPHPUnitResultPrinter extends ResultPrinter {
|
|
protected function printDefectTrace( TestFailure $defect ) : void {
|
|
parent::printDefectTrace( $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" );
|
|
}
|
|
}
|
|
}
|
|
}
|