MediaWiki  1.23.15
BadTitleErrorTest.php
Go to the documentation of this file.
1 <?php
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;
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 }
BadTitleErrorTest
@covers BadTitleError
Definition: BadTitleErrorTest.php:6
BadTitleErrorTest\getMockWgOut
getMockWgOut()
Definition: BadTitleErrorTest.php:33
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
BadTitleErrorTest\testExceptionSetsStatusCode
testExceptionSetsStatusCode()
Definition: BadTitleErrorTest.php:22
BadTitleErrorTest\tearDown
tearDown()
Definition: BadTitleErrorTest.php:16
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
BadTitleErrorTest\setUp
setUp()
Definition: BadTitleErrorTest.php:10
BadTitleErrorTest\$wgOut
$wgOut
Definition: BadTitleErrorTest.php:8
BadTitleError
Show an error page on a badtitle.
Definition: BadTitleError.php:29
$e
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:1632