Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / includes / exception / BadTitleErrorTest.php
blob8569ea72cf6381aa30cb3e4582797087aa63e9a1
1 <?php
3 use MediaWiki\Output\OutputPage;
5 /**
6 * @covers \BadTitleError
7 * @author Addshore
8 */
9 class BadTitleErrorTest extends MediaWikiIntegrationTestCase {
11 public function testExceptionSetsStatusCode() {
12 $mockOut = $this->createMock( OutputPage::class );
13 $mockOut->expects( $this->once() )
14 ->method( 'setStatusCode' )
15 ->with( 404 );
16 $this->setMwGlobals( 'wgOut', $mockOut );
18 try {
19 throw new BadTitleError();
20 } catch ( BadTitleError $e ) {
21 ob_start();
22 $e->report();
23 $text = ob_get_clean();
24 $this->assertStringContainsString( $e->getMessage(), $text );