Merge "Revert "selenium: add new message banner test to user spec""
[lhc/web/wiklou.git] / tests / phpunit / includes / exception / BadTitleErrorTest.php
1 <?php
2 /**
3 * @covers BadTitleError
4 * @author Addshore
5 */
6 class BadTitleErrorTest extends MediaWikiTestCase {
7
8 public function testExceptionSetsStatusCode() {
9 $this->setMwGlobals( 'wgOut', $this->getMockWgOut() );
10 try {
11 throw new BadTitleError();
12 } catch ( BadTitleError $e ) {
13 $e->report();
14 $this->assertTrue( true );
15 }
16 }
17
18 private function getMockWgOut() {
19 $mock = $this->getMockBuilder( OutputPage::class )
20 ->disableOriginalConstructor()
21 ->getMock();
22 $mock->expects( $this->once() )
23 ->method( 'setStatusCode' )
24 ->with( 400 );
25 return $mock;
26 }
27
28 }