Single use method in both BadTitleErrorTest and ThrottledErrorTest, merge into only place that needs it Change-Id: I1a5c2ed2ac76ae821758d50b7d6378acb98af861
27 lines
611 B
PHP
27 lines
611 B
PHP
<?php
|
|
/**
|
|
* @covers BadTitleError
|
|
* @author Addshore
|
|
*/
|
|
class BadTitleErrorTest extends MediaWikiIntegrationTestCase {
|
|
|
|
public function testExceptionSetsStatusCode() {
|
|
$mockOut = $this->getMockBuilder( OutputPage::class )
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
$mockOut->expects( $this->once() )
|
|
->method( 'setStatusCode' )
|
|
->with( 400 );
|
|
$this->setMwGlobals( 'wgOut', $mockOut );
|
|
|
|
try {
|
|
throw new BadTitleError();
|
|
} catch ( BadTitleError $e ) {
|
|
ob_start();
|
|
$e->report();
|
|
$text = ob_get_clean();
|
|
$this->assertStringContainsString( $e->getText(), $text );
|
|
}
|
|
}
|
|
|
|
}
|