Merge "Removing Wikitravel from the default interwiki list"
[lhc/web/wiklou.git] / tests / phpunit / includes / exception / BadTitleErrorTest.php
1 <?php
2 /**
3 * @covers BadTitleError
4 * @author Adam Shorland
5 */
6 class BadTitleErrorTest extends MediaWikiTestCase {
7
8 protected $wgOut;
9
10 protected function setUp() {
11 parent::setUp();
12 global $wgOut;
13 $this->wgOut = clone $wgOut;
14 }
15
16 protected function tearDown() {
17 parent::tearDown();
18 global $wgOut;
19 $wgOut = $this->wgOut;
20 }
21
22 public function testExceptionSetsStatusCode() {
23 global $wgOut;
24 $wgOut = $this->getMockWgOut();
25 try {
26 throw new BadTitleError();
27 } catch ( BadTitleError $e ) {
28 $e->report();
29 $this->assertTrue( true );
30 }
31 }
32
33 private function getMockWgOut() {
34 $mock = $this->getMockBuilder( 'OutputPage' )
35 ->disableOriginalConstructor()
36 ->getMock();
37 $mock->expects( $this->once() )
38 ->method( 'setStatusCode' )
39 ->with( 400 );
40 return $mock;
41 }
42
43 }