MediaWiki
REL1_32
SpecialPageFatalTest.php
Go to the documentation of this file.
1
<?php
2
3
use
MediaWiki\MediaWikiServices
;
4
15
class
SpecialPageFatalTest
extends
MediaWikiTestCase
{
16
public
function
provideSpecialPages
() {
17
$specialPages = [];
18
$spf = MediaWikiServices::getInstance()->getSpecialPageFactory();
19
foreach
( $spf->getNames() as $name ) {
20
$specialPages[
$name
] = [ $spf->getPage( $name ) ];
21
}
22
return
$specialPages;
23
}
24
28
public
function
testSpecialPageDoesNotFatal
(
SpecialPage
$page ) {
29
$executor =
new
SpecialPageExecutor
();
30
$user =
User::newFromName
(
'UTSysop'
);
31
32
try
{
33
$executor->executeSpecialPage( $page,
''
,
null
,
null
, $user );
34
}
catch
( Exception
$e
) {
35
// Exceptions are allowed
36
}
37
38
// If the page fataled phpunit will have already died
39
$this->addToAssertionCount( 1 );
40
}
41
42
}
MediaWikiTestCase
Definition
MediaWikiTestCase.php:16
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition
MediaWikiServices.php:99
SpecialPageExecutor
Definition
SpecialPageExecutor.php:8
SpecialPageFatalTest
Test that runs against all registered special pages to make sure that regular execution of the specia...
Definition
SpecialPageFatalTest.php:15
SpecialPageFatalTest\provideSpecialPages
provideSpecialPages()
Definition
SpecialPageFatalTest.php:16
SpecialPageFatalTest\testSpecialPageDoesNotFatal
testSpecialPageDoesNotFatal(SpecialPage $page)
provideSpecialPages
Definition
SpecialPageFatalTest.php:28
SpecialPage
Parent class for all special pages.
Definition
SpecialPage.php:36
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition
User.php:592
$name
Allows to change the fields on the form that will be generated $name
Definition
hooks.txt:302
$e
returning false will NOT prevent logging $e
Definition
hooks.txt:2226
tests
phpunit
structure
SpecialPageFatalTest.php
Generated on Mon Nov 25 2024 15:59:05 for MediaWiki by
1.10.0