MediaWiki REL1_32
SpecialPageFatalTest.php
Go to the documentation of this file.
1<?php
2
4
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}
MediaWikiServices is the service locator for the application scope of MediaWiki.
Test that runs against all registered special pages to make sure that regular execution of the specia...
testSpecialPageDoesNotFatal(SpecialPage $page)
provideSpecialPages
Parent class for all special pages.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition User.php:592
Allows to change the fields on the form that will be generated $name
Definition hooks.txt:302
returning false will NOT prevent logging $e
Definition hooks.txt:2226