MediaWiki  1.23.2
ErrorPageErrorTest.php
Go to the documentation of this file.
1 <?php
2 
8 
9  private $wgOut;
10 
11  protected function setUp() {
12  parent::setUp();
13  global $wgOut;
14  $this->wgOut = clone $wgOut;
15  }
16 
17  protected function tearDown() {
18  global $wgOut;
20  parent::tearDown();
21  }
22 
23  private function getMockMessage() {
24  $mockMessage = $this->getMockBuilder( 'Message' )
25  ->disableOriginalConstructor()
26  ->getMock();
27  $mockMessage->expects( $this->once() )
28  ->method( 'inLanguage' )
29  ->will( $this->returnValue( $mockMessage ) );
30  $mockMessage->expects( $this->once() )
31  ->method( 'useDatabase' )
32  ->will( $this->returnValue( $mockMessage ) );
33  return $mockMessage;
34  }
35 
36  public function testConstruction() {
37  $mockMessage = $this->getMockMessage();
38  $title = 'Foo';
39  $params = array( 'Baz' );
40  $e = new ErrorPageError( $title, $mockMessage, $params );
41  $this->assertEquals( $title, $e->title );
42  $this->assertEquals( $mockMessage, $e->msg );
43  $this->assertEquals( $params, $e->params );
44  }
45 
46  public function testReport() {
47  $mockMessage = $this->getMockMessage();
48  $title = 'Foo';
49  $params = array( 'Baz' );
50 
51  global $wgOut;
52  $wgOut = $this->getMockBuilder( 'OutputPage' )
53  ->disableOriginalConstructor()
54  ->getMock();
55  $wgOut->expects( $this->once() )
56  ->method( 'showErrorPage' )
57  ->with( $title, $mockMessage, $params );
58  $wgOut->expects( $this->once() )
59  ->method( 'output' );
60 
61  $e = new ErrorPageError( $title, $mockMessage, $params );
62  $e->report();
63  }
64 
65 
66 
67 }
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
ErrorPageErrorTest\$wgOut
$wgOut
Definition: ErrorPageErrorTest.php:9
ErrorPageErrorTest\getMockMessage
getMockMessage()
Definition: ErrorPageErrorTest.php:23
$params
$params
Definition: styleTest.css.php:40
ErrorPageErrorTest\setUp
setUp()
Definition: ErrorPageErrorTest.php:11
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
ErrorPageErrorTest\tearDown
tearDown()
Definition: ErrorPageErrorTest.php:17
ErrorPageErrorTest\testConstruction
testConstruction()
Definition: ErrorPageErrorTest.php:36
ErrorPageErrorTest
@covers ErrorPageError
Definition: ErrorPageErrorTest.php:7
ErrorPageErrorTest\testReport
testReport()
Definition: ErrorPageErrorTest.php:46
$e
if( $useReadline) $e
Definition: eval.php:66
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition: ErrorPageError.php:27