wiki.techinc.nl/tests/phpunit/includes/exception/ErrorPageErrorTest.php
Derick Alangi cb03a63230 tests: Migrate away from setMwGlobals()
Make use of `overrideConfigValue(s)()` where needed and also
make use of MainConfigNames constants.

NOTE: group multiple calls to setMwGlobals() to one and pass
  an array of values instead.
Change-Id: I3bbfd037bb3765c00c426682cce3ef5cccc1a284
2022-08-22 20:17:49 +00:00

39 lines
952 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->createMock( OutputPage::class );
$mock->expects( $this->once() )
->method( 'showErrorPage' )
->with( $title, $mockMessage, $params );
$mock->expects( $this->once() )
->method( 'output' );
$this->setMwGlobals( [
'wgOut' => $mock,
'wgCommandLineMode' => false,
] );
$e = new ErrorPageError( $title, $mockMessage, $params );
$e->report();
}
}