4 * @covers ErrorPageError
5 * @author Adam Shorland
7 class ErrorPageErrorTest
extends MediaWikiTestCase
{
11 protected function setUp() {
14 $this->wgOut
= clone $wgOut;
17 protected function tearDown() {
19 $wgOut = $this->wgOut
;
23 private function getMockMessage() {
24 $mockMessage = $this->getMockBuilder( 'Message' )
25 ->disableOriginalConstructor()
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 ) );
36 public function testConstruction() {
37 $mockMessage = $this->getMockMessage();
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
);
46 public function testReport() {
47 $mockMessage = $this->getMockMessage();
49 $params = array( 'Baz' );
52 $wgOut = $this->getMockBuilder( 'OutputPage' )
53 ->disableOriginalConstructor()
55 $wgOut->expects( $this->once() )
56 ->method( 'showErrorPage' )
57 ->with( $title, $mockMessage, $params );
58 $wgOut->expects( $this->once() )
61 $e = new ErrorPageError( $title, $mockMessage, $params );