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
{
17 public static function setUpBeforeClass() {
18 parent
::setUpBeforeClass();
19 self
::overrideMwServices();
22 public static function tearDownAfterClass() {
23 self
::overrideMwServices();
24 parent
::tearDownAfterClass();
27 public function provideSpecialPages() {
29 $spf = MediaWikiServices
::getInstance()->getSpecialPageFactory();
30 foreach ( $spf->getNames() as $name ) {
31 $specialPages[$name] = [ $spf->getPage( $name ) ];
37 * @dataProvider provideSpecialPages
39 public function testSpecialPageDoesNotFatal( SpecialPage
$page ) {
40 $executor = new SpecialPageExecutor();
41 $user = User
::newFromName( 'UTSysop' );
44 $executor->executeSpecialPage( $page, '', null, null, $user );
45 } catch ( Exception
$e ) {
46 // Exceptions are allowed
49 // If the page fataled phpunit will have already died
50 $this->addToAssertionCount( 1 );