blob: 13dcf33b277f5575674eec62f8599d771af6b313 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<?php
/**
* @covers ErrorPageError
* @author Adam Shorland
*/
class ErrorPageErrorTest extends MediaWikiTestCase {
private $wgOut;
protected function setUp() {
parent::setUp();
global $wgOut;
$this->wgOut = clone $wgOut;
}
protected function tearDown() {
global $wgOut;
$wgOut = $this->wgOut;
parent::tearDown();
}
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 = array( '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 = array( 'Baz' );
global $wgOut;
$wgOut = $this->getMockBuilder( 'OutputPage' )
->disableOriginalConstructor()
->getMock();
$wgOut->expects( $this->once() )
->method( 'showErrorPage' )
->with( $title, $mockMessage, $params );
$wgOut->expects( $this->once() )
->method( 'output' );
$e = new ErrorPageError( $title, $mockMessage, $params );
$e->report();
}
}
|