MediaWiki
REL1_31
BadTitleErrorTest.php
Go to the documentation of this file.
1
<?php
6
class
BadTitleErrorTest
extends
MediaWikiTestCase
{
7
8
public
function
testExceptionSetsStatusCode
() {
9
$this->
setMwGlobals
(
'wgOut'
, $this->
getMockWgOut
() );
10
try
{
11
throw
new
BadTitleError
();
12
}
catch
(
BadTitleError
$e
) {
13
ob_start();
14
$e
->report();
15
$text = ob_get_clean();
16
$this->assertContains(
$e
->getText(), $text );
17
}
18
}
19
20
private
function
getMockWgOut
() {
21
$mock = $this->getMockBuilder( OutputPage::class )
22
->disableOriginalConstructor()
23
->getMock();
24
$mock->expects( $this->once() )
25
->method(
'setStatusCode'
)
26
->with( 400 );
27
return
$mock;
28
}
29
30
}
BadTitleErrorTest
BadTitleError.
Definition
BadTitleErrorTest.php:6
BadTitleErrorTest\getMockWgOut
getMockWgOut()
Definition
BadTitleErrorTest.php:20
BadTitleErrorTest\testExceptionSetsStatusCode
testExceptionSetsStatusCode()
Definition
BadTitleErrorTest.php:8
BadTitleError
Show an error page on a badtitle.
Definition
BadTitleError.php:30
MediaWikiTestCase
Definition
MediaWikiTestCase.php:17
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
Definition
MediaWikiTestCase.php:678
$e
returning false will NOT prevent logging $e
Definition
hooks.txt:2176
tests
phpunit
includes
exception
BadTitleErrorTest.php
Generated on Mon Nov 25 2024 15:36:21 for MediaWiki by
1.10.0