wiki.techinc.nl/tests/phpunit/includes/exception/ErrorPageErrorTest.php
Kunal Mehta 6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00

51 lines
1.3 KiB
PHP

<?php
/**
* @covers ErrorPageError
* @author Addshore
*/
class ErrorPageErrorTest extends MediaWikiTestCase {
private function getMockMessage() {
$mockMessage = $this->getMockBuilder( 'Message' )
->disableOriginalConstructor()
->getMock();
$mockMessage->expects( $this->once() )
->method( 'inLanguage' )
->will( $this->returnValue( $mockMessage ) );
$mockMessage->expects( $this->once() )
->method( 'useDatabase' )
->will( $this->returnValue( $mockMessage ) );
return $mockMessage;
}
public function testConstruction() {
$mockMessage = $this->getMockMessage();
$title = 'Foo';
$params = [ 'Baz' ];
$e = new ErrorPageError( $title, $mockMessage, $params );
$this->assertEquals( $title, $e->title );
$this->assertEquals( $mockMessage, $e->msg );
$this->assertEquals( $params, $e->params );
}
public function testReport() {
$mockMessage = $this->getMockMessage();
$title = 'Foo';
$params = [ 'Baz' ];
$mock = $this->getMockBuilder( 'OutputPage' )
->disableOriginalConstructor()
->getMock();
$mock->expects( $this->once() )
->method( 'showErrorPage' )
->with( $title, $mockMessage, $params );
$mock->expects( $this->once() )
->method( 'output' );
$this->setMwGlobals( 'wgOut', $mock );
$e = new ErrorPageError( $title, $mockMessage, $params );
$e->report();
}
}