It's annoying and pointless. Instead, have MWException write them to
standard output where we can catch them with ob_start().
Bug: T170028
Bug: T170029
Change-Id: Icd99c1c39d4a30d78c511d33948ef639e1b92455
} elseif ( self::isCommandLine() ) {
$message = $this->getText();
// T17602: STDERR may not be available
- if ( defined( 'STDERR' ) ) {
+ if ( !defined( 'MW_PHPUNIT_TEST' ) && defined( 'STDERR' ) ) {
fwrite( STDERR, $message );
} else {
echo $message;
try {
throw new BadTitleError();
} catch ( BadTitleError $e ) {
+ ob_start();
$e->report();
- $this->assertTrue( true );
+ $text = ob_get_clean();
+ $this->assertContains( $e->getText(), $text );
}
}
try {
throw new ThrottledError();
} catch ( ThrottledError $e ) {
+ ob_start();
$e->report();
- $this->assertTrue( true );
+ $text = ob_get_clean();
+ $this->assertContains( $e->getText(), $text );
}
}