2014-02-27 00:00:17 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers ErrorPageError
|
2016-01-27 09:59:31 +00:00
|
|
|
* @author Addshore
|
2014-02-27 00:00:17 +00:00
|
|
|
*/
|
2020-06-30 15:09:24 +00:00
|
|
|
class ErrorPageErrorTest extends MediaWikiIntegrationTestCase {
|
2014-02-27 00:00:17 +00:00
|
|
|
|
|
|
|
|
public function testConstruction() {
|
|
|
|
|
$mockMessage = $this->getMockMessage();
|
|
|
|
|
$title = 'Foo';
|
2016-02-17 09:09:32 +00:00
|
|
|
$params = [ 'Baz' ];
|
2014-02-27 00:00:17 +00:00
|
|
|
$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';
|
2016-02-17 09:09:32 +00:00
|
|
|
$params = [ 'Baz' ];
|
2014-02-27 00:00:17 +00:00
|
|
|
|
2022-07-14 12:42:07 +00:00
|
|
|
$mock = $this->createMock( OutputPage::class );
|
2014-11-06 20:17:20 +00:00
|
|
|
$mock->expects( $this->once() )
|
2014-02-27 00:00:17 +00:00
|
|
|
->method( 'showErrorPage' )
|
|
|
|
|
->with( $title, $mockMessage, $params );
|
2014-11-06 20:17:20 +00:00
|
|
|
$mock->expects( $this->once() )
|
2014-02-27 00:00:17 +00:00
|
|
|
->method( 'output' );
|
2022-08-19 20:03:47 +00:00
|
|
|
$this->setMwGlobals( [
|
|
|
|
|
'wgOut' => $mock,
|
|
|
|
|
'wgCommandLineMode' => false,
|
|
|
|
|
] );
|
2014-02-27 00:00:17 +00:00
|
|
|
|
|
|
|
|
$e = new ErrorPageError( $title, $mockMessage, $params );
|
|
|
|
|
$e->report();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|