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\Deprecated
$deprecated ) {
37 // this test want to check fatals or other things breaking the extension
38 } catch ( \PHPUnit\Framework\Error\Error
$error ) {
39 // Let phpunit settings working:
40 // - convertErrorsToExceptions="true"
41 // - convertNoticesToExceptions="true"
42 // - convertWarningsToExceptions="true"
44 } catch ( Exception
$e ) {
45 // Other exceptions are allowed
48 // If the page fataled phpunit will have already died
49 $this->addToAssertionCount( 1 );