4 * @covers ErrorPageError
7 class ErrorPageErrorTest
extends MediaWikiTestCase
{
9 private function getMockMessage() {
10 $mockMessage = $this->getMockBuilder( 'Message' )
11 ->disableOriginalConstructor()
13 $mockMessage->expects( $this->once() )
14 ->method( 'inLanguage' )
15 ->will( $this->returnValue( $mockMessage ) );
16 $mockMessage->expects( $this->once() )
17 ->method( 'useDatabase' )
18 ->will( $this->returnValue( $mockMessage ) );
22 public function testConstruction() {
23 $mockMessage = $this->getMockMessage();
26 $e = new ErrorPageError( $title, $mockMessage, $params );
27 $this->assertEquals( $title, $e->title
);
28 $this->assertEquals( $mockMessage, $e->msg
);
29 $this->assertEquals( $params, $e->params
);
32 public function testReport() {
33 $mockMessage = $this->getMockMessage();
37 $mock = $this->getMockBuilder( 'OutputPage' )
38 ->disableOriginalConstructor()
40 $mock->expects( $this->once() )
41 ->method( 'showErrorPage' )
42 ->with( $title, $mockMessage, $params );
43 $mock->expects( $this->once() )
45 $this->setMwGlobals( 'wgOut', $mock );
47 $e = new ErrorPageError( $title, $mockMessage, $params );