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.
15 class SpecialPageFatalTest
extends MediaWikiTestCase
{
16 public function provideSpecialPages() {
18 $spf = MediaWikiServices
::getInstance()->getSpecialPageFactory();
19 foreach ( $spf->getNames() as $name ) {
20 $specialPages[$name] = [ $spf->getPage( $name ) ];
26 * @dataProvider provideSpecialPages
28 public function testSpecialPageDoesNotFatal( SpecialPage
$page ) {
29 $executor = new SpecialPageExecutor();
30 $user = User
::newFromName( 'UTSysop' );
33 $executor->executeSpecialPage( $page, '', null, null, $user );
34 } catch ( \PHPUnit\Framework\Error\Deprecated
$deprecated ) {
36 // this test want to check fatals or other things breaking the extension
37 } catch ( \PHPUnit\Framework\Error\Error
$error ) {
38 // Let phpunit settings working:
39 // - convertErrorsToExceptions="true"
40 // - convertNoticesToExceptions="true"
41 // - convertWarningsToExceptions="true"
43 } catch ( Exception
$e ) {
44 // Other exceptions are allowed
47 // If the page fataled phpunit will have already died
48 $this->addToAssertionCount( 1 );