wiki.techinc.nl/tests/phpunit/structure/SpecialPageFatalTest.php
Umherirrender d28f315d24 Add @coversNothing for left over tests and enable sniff
LessFileCompilationTest is checking less files for valid syntax
doc test is checking xml file for valid syntax
MediaWikiTest is testing a complex situation with many functions involved
SideBarTest is self checking, needs no coverage
structure tests not covers functions, there are covers global structures

Change-Id: I3ac65db561cae0be8418aa9c830e7a9f46ad11fe
2019-02-02 21:53:40 -08:00

43 lines
1.1 KiB
PHP

<?php
use MediaWiki\MediaWikiServices;
/**
* Test that runs against all registered special pages to make sure that regular
* execution of the special page does not cause a fatal error.
*
* UTSysop is used to run as much of the special page code as possible without
* actually knowing the details of the special page.
*
* @since 1.32
* @author Addshore
* @coversNothing
*/
class SpecialPageFatalTest extends MediaWikiTestCase {
public function provideSpecialPages() {
$specialPages = [];
$spf = MediaWikiServices::getInstance()->getSpecialPageFactory();
foreach ( $spf->getNames() as $name ) {
$specialPages[$name] = [ $spf->getPage( $name ) ];
}
return $specialPages;
}
/**
* @dataProvider provideSpecialPages
*/
public function testSpecialPageDoesNotFatal( SpecialPage $page ) {
$executor = new SpecialPageExecutor();
$user = User::newFromName( 'UTSysop' );
try {
$executor->executeSpecialPage( $page, '', null, null, $user );
} catch ( Exception $e ) {
// Exceptions are allowed
}
// If the page fataled phpunit will have already died
$this->addToAssertionCount( 1 );
}
}