wiki.techinc.nl/tests/phpunit/includes/exception/ErrorPageErrorTest.php
addshore 959bc315f2 MediaWikiTestCase to MediaWikiIntegrationTestCase
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)

My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.

Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
2020-06-30 17:02:22 +01:00

39 lines
1,013 B
PHP

<?php
/**
* @covers ErrorPageError
* @author Addshore
*/
class ErrorPageErrorTest extends MediaWikiIntegrationTestCase {
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::class )
->disableOriginalConstructor()
->getMock();
$mock->expects( $this->once() )
->method( 'showErrorPage' )
->with( $title, $mockMessage, $params );
$mock->expects( $this->once() )
->method( 'output' );
$this->setMwGlobals( 'wgOut', $mock );
$this->setMwGlobals( 'wgCommandLineMode', false );
$e = new ErrorPageError( $title, $mockMessage, $params );
$e->report();
}
}