3 use MediaWiki\MediaWikiServices
;
6 * Test that runs against all registered special pages to make sure that regular
7 * execution of the special page does not cause a fatal error.
9 * UTSysop is used to run as much of the special page code as possible without
10 * actually knowing the details of the special page.
16 class SpecialPageFatalTest
extends MediaWikiTestCase
{
17 public function provideSpecialPages() {
19 $spf = MediaWikiServices
::getInstance()->getSpecialPageFactory();
20 foreach ( $spf->getNames() as $name ) {
21 $specialPages[$name] = [ $spf->getPage( $name ) ];
27 * @dataProvider provideSpecialPages
29 public function testSpecialPageDoesNotFatal( SpecialPage
$page ) {
30 $executor = new SpecialPageExecutor();
31 $user = User
::newFromName( 'UTSysop' );
34 $executor->executeSpecialPage( $page, '', null, null, $user );
35 } catch ( \PHPUnit\Framework\Error\Error
$error ) {
36 // Let phpunit settings working:
37 // - convertErrorsToExceptions="true"
38 // - convertNoticesToExceptions="true"
39 // - convertWarningsToExceptions="true"
41 } catch ( Exception
$e ) {
42 // Other exceptions are allowed
45 // If the page fataled phpunit will have already died
46 $this->addToAssertionCount( 1 );