wiki.techinc.nl/tests/phpunit/includes/exception/BadTitleErrorTest.php
DannyS712 fcecd9c5e4 Remove sepate getMockWgOut() method in exception tests
Single use method in both BadTitleErrorTest and ThrottledErrorTest,
merge into only place that needs it

Change-Id: I1a5c2ed2ac76ae821758d50b7d6378acb98af861
2021-03-08 03:54:14 +00:00

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 );
}
}
}