Move ResultWrapper subclasses to Rdbms
[mediawiki.git] / tests / phpunit / includes / exception / ErrorPageErrorTest.php
blob71398e3f64cf5ee3f16fc7a239246d7e9070f597
1 <?php
3 /**
4 * @covers ErrorPageError
5 * @author Addshore
6 */
7 class ErrorPageErrorTest extends MediaWikiTestCase {
9 private function getMockMessage() {
10 $mockMessage = $this->getMockBuilder( 'Message' )
11 ->disableOriginalConstructor()
12 ->getMock();
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 ) );
19 return $mockMessage;
22 public function testConstruction() {
23 $mockMessage = $this->getMockMessage();
24 $title = 'Foo';
25 $params = [ 'Baz' ];
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();
34 $title = 'Foo';
35 $params = [ 'Baz' ];
37 $mock = $this->getMockBuilder( 'OutputPage' )
38 ->disableOriginalConstructor()
39 ->getMock();
40 $mock->expects( $this->once() )
41 ->method( 'showErrorPage' )
42 ->with( $title, $mockMessage, $params );
43 $mock->expects( $this->once() )
44 ->method( 'output' );
45 $this->setMwGlobals( 'wgOut', $mock );
47 $e = new ErrorPageError( $title, $mockMessage, $params );
48 $e->report();